- Water Jug Problem using Memoization
- Count number of triplets with product equal to given number with duplicates allowed
- Number of ways to divide a given number as a set of integers in decreasing order
- Generating subarrays using recursion
- Generating all possible Subsequences using Recursion
- Why does sizeof(x++) not increment x in C?
- Address Calculation Sort using Hashing
- Check if the given 2-D points form T-shape or not
- Johnsonâ€™s algorithm for All-pairs shortest paths | Implementation
- 2-3 Trees | (Search and Insert)
- Is sizeof for a struct equal to the sum of sizeof of each member?
- Find if an undirected graph contains an independent set of a given size
- Minimum difference between the highest and the smallest value of mines distributed
- Printing all subsets of {1,2,3,...n} without using array or loop
- Clone a stack without extra space
- Nested List Comprehensions in Python
- Number of Walks from source to destination
- Comprehensions in Python
- Find maximum distance between any city and station
- Iterate over a dictionary in Python
- Python | Create a Pandas Dataframe from a dict of equal length lists
- Maximum even length sub-string that is permutation of a palindrome
- How to rename columns in Pandas DataFrame
- Python | Sort list of dates given as strings
- Longest Ordered Subsequence of Vowels
- Sub-strings of a string that are prefix of the same string
- Python program to print the substrings that are prefix of the given string
- CSS | transition-property Property
- CSS | Pseudo-classes
- Print first n distinct permutations of string using itertools in Python
- Python | Implementing 3D Vectors using dunder methods

- Find the smallest window in a string containing all characters of another string
- Check whether a given string is an interleaving of two other given strings
- Given a sequence of words, print all anagrams together | Set 1
- Check whether a given graph is Bipartite or not
- Expression Evaluation
- Find the element before which all the elements are smaller than it, and after which all are greater
- Convert a Binary Tree to Threaded binary tree | Set 1 (Using Queue)
- Longest Even Length Substring such that Sum of First and Second Half is same
- Group multiple occurrence of array elements ordered by first occurrence
- Find sum of all elements in a matrix except the elements in row and/or column of given cell?
- Find all possible outcomes of a given expression
- Combinatorial Game Theory | Set 3 (Grundy Numbers/Nimbers and Mex)
- Number of Integral Points between Two Points
- Fifth root of a number
- Find subarray with given sum | Set 2 (Handles Negative Numbers)
- Maximum product of a triplet (subsequnece of size 3) in array
- Maximum profit by buying and selling a share at most k times
- Pair with given product | Set 1 (Find if any pair exists)
- Minimax Algorithm in Game Theory | Set 2 (Introduction to Evaluation Function)
- Rearrange a string so that all same characters become atleast d distance away
- Longest Common Prefix using Divide and Conquer Algorithm
- Rearrange positive and negative numbers with constant extra space
- Maximize arr[j] - arr[i] + arr[l] - arr[k], such that i < j < k < l
- Minimax Algorithm in Game Theory | Set 4 (Alpha-Beta Pruning)
- Find if an expression has duplicate parenthesis or not
- Minimum characters to be added at front to make string palindrome
- Sieve of Eratosthenes in 0(n) time complexity
- Find elements which are present in first array and not in second
- Check whether row or column swaps produce maximum size binary sub-matrix with all 1s
- Maximum area of triangle having different vertex colors
- Count trailing zero bits using lookup table
- Maximize sum of N X N upper left sub-matrix from given 2N X 2N matrix
- Sorting possible using size 3 subarray rotation
- Check if a doubly linked list of characters is palindrome or not
- Search in an array of strings where non-empty strings are sorted
- Character replacement after removing duplicates from a string
- Minimum swaps to reach permuted array with at most 2 positions left swaps allowed
- Count of arrays in which all adjacent elements are such that one of them divide the another
- Maximum sum two non-overlapping subarrays of given size
- TimSort
- Number of times the largest perfect square number can be subtracted from N
- Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array | Set-2
- Check if a king can move a valid move or not when N nights are there in a modified chessboard
- Non-overlapping sum of two sets
- Shortest path between two nodes in array like representation of binary tree
- Minimum Fibonacci terms with sum equal to K
- Remove one bit from a binary number to get maximum value
- Count of Palindromic substrings in an Index range
- Find the Sub-array with sum closest to 0
- Print the string by ignoring alternate occurrences of any character
- Find numbers of balancing positions in string
- Maximum score after flipping a Binary Matrix atmost K times
- Reverse a Linked List according to its Size
- Maximum possible sum of a window in an array such that elements of same window in other array are unique
- Find n-th lexicographically permutation of a string | Set 2
- Calculate number of nodes in all subtrees | Using DFS
- A modified game of Nim
- Find the n-th number whose binary representation is a palindrome
- Minimum cells traversed to reach corner where every cell represents jumps
- Check if a grid can become row-wise and column-wise sorted after adjacent swaps
- Count pairs in an array such that LCM(arr[i], arr[j]) > min(arr[i],arr[j])
- Check if the string contains consecutive letters and each letter occurs exactly once
- Minimum operation to make all elements equal in array
- Check if there is a cycle with odd weight sum in an undirected graph
- Rearrangement of a number which is also divisible by it
- Check if given array is almost sorted (elements are at-most one position away)
- Maximum length subsequence with difference between adjacent elements as either 0 or 1 | Set 2
- Largest subarray having sum greater than k
- Longest Common Subsequence with at most k changes allowed
- Node having maximum sum of immediate children and itself in n-ary tree
- Replace two substrings (of a string) with each other
- Maximum length subsequence possible of the form R^N K^N
- Check if the given array can represent Level Order Traversal of Binary Search Tree
- Cumulative frequency of count of each element in an unsorted array
- Index Mapping (or Trivial Hashing) with negatives allowed
- Distinct permutations of the string | Set 2
- Smallest subarray with k distinct numbers
- Distributing items when a person cannot take more than two items of same type
- Products of ranges in an array
- Sorting using trivial hash function
- Differences between number of increasing subarrays and decreasing subarrays in k sized windows
- Next word that does not contain a palindrome and has characters from first k
- Number of GP (Geometric Progression) subsequences of size 3
- Sparse Table
- Minimum characters to be replaced to remove the given substring
- Minimum array element changes to make its elements 1 to N
- Select a Random Node from a tree with equal probability
- Queries for frequencies of characters in substrings
- Total numbers with no repeated digits in a range
- Remove all outgoing edges except edge with minimum weight
- Subtree of all nodes in a tree using DFS
- Area of hexagon with given diagonal length
- Find maximum number of elements such that their absolute difference is less than or equal to 1
- Sum of maximum elements of all possible sub-arrays of an array
- Why does sizeof(x++) not increment x in C?
- Sum of each element raised to (prime-1) % prime
- Invert actual bits of a number
- n-th number whose sum of digits is ten
- Schedule jobs so that each server gets equal load
- Maximum Product Subarray | Added negative product case
- Number of subarrays having sum exactly equal to k
- Hypercube Graph
- Number of subsets with product less than k
- Number of Unicolored Paths between two nodes
- Dynamic Disjoint Set Data Structure for large range values
- Fibonacci Cube Graph
- Euler's Four Square Identity
- Sum of nodes at maximum depth of a Binary Tree
- Leftover element after performing alternate Bitwise OR and Bitwise XOR operations on adjacent pairs
- First element that appears even number of times in an array
- Largest palindromic number by permuting digits
- Check if number can be displayed using seven segment led
- Check if it possible to partition in k subarrays with equal sum
- Longest Palindromic Substring using Palindromic Tree | Set 3
- Minimum cost to process m tasks where switching costs
- Number of single cycle components in an undirected graph
- Maximum adjacent difference in an array in its sorted form
- Find if k bookings possible with given arrival and departure times
- Lexicographically Kth smallest way to reach given coordinate from origin
- Check if it is possible to make the given matrix increasing matrix or not
- Print Longest substring without repeating characters
- Students with maximum average score of three subjects
- Given two numbers as strings, find if one is a power of other
- Sort the biotonic doubly linked list | Set-2
- Check if given Sudoku board configuration is valid or not
- Check if a string can be formed from another string using given constraints
- Check if two trees are mirror of each other using level order traversal
- Check if two nodes are cousins in a Binary Tree | Set-2
- Number of Unique BST with a given key | Dynamic Programming
- Count the number of intervals in which a given value lies
- Print all distinct integers that can be formed by K numbers from a given array of N numbers
- Rearrange a Linked List in Zig-Zag fashion | Set-2
- Make all numbers of an array equal
- Level order traversal with direction change after every two levels | Recursive Approach
- Program to print last N lines | Set-2
- Element which occurs consecutively in a given subarray more than or equal to K times
- Maximize the sum of X+Y elements by picking X and Y elements from 1st and 2nd array
- Print levels with odd number of nodes and even number of nodes
- Minimum changes needed to make a 3*3 matrix magic square
- Maximum bishops that can be placed on N*N chessboard
- Smallest divisor D of N such that gcd(D, M) is greater than 1
- Print all the pairs that contains the positive and negative values of an element
- Maximum power of jump required to reach the end of string
- Number of ways to represent a number as sum of k fibonacci numbers
- Shortest distance between two nodes in an infinite binary tree
- Check if is possible to get given sum from a given set of elements
- Longest subsequence whose average is less than K
- Maximum value of XOR among all triplets of an array
- Longest common anagram subsequence from N strings
- Add two unsigned numbers using bits
- Sum of all elements repeating 'k' times in an array
- Split array to three subarrays such that sum of first and third subarray is equal and maximum
- Tail recursion to calculate sum of array elements.
- Number of divisors of product of N numbers
- Minimize ASCII values sum after removing all occurrences of one character
- Product of lengths of all cycles in an undirected graph
- Lexicographically smallest permutation of a string with given subsequences
- Minimum operation require to make first and last character same
- Generating subarrays using recursion
- Longest subarray having difference in the count of 1's and 0's equal to k
- Minimum number of palindromes required to express N as a sum | Set 2
- Count numbers (smaller than or equal to N) with given digit sum
- Program to find the diameter, cycles and edges of a Wheel Graph
- Count number of integers less than or equal to N which has exactly 9 divisors
- Sum of minimum elements of all subarrays
- Length of largest sub-array having primes strictly greater than non-primes
- Replace even nodes of a doubly linked list with the elements of array
- Number of values of b such that a = b + (a^b)
- Replace minimal number of characters to make all characters pair wise distinct
- Rearrange the string to maximize the number of palindromic substrings
- Queries to add, remove and return the difference of maximum and minimum.
- Check if an integer can be expressed as a sum of two semi-primes
- Hammered distance between N points in a 2-D plane
- Maximum removal from array when removal time >= waiting time
- Check whether the given number is Euclid Number or not
- Count the number of pop operations on stack to get each element of the array
- Maximize the number of subarrays with XOR as zero
- Ulam Number Sequence
- Sum of every K'th prime number in an array
- Minimum Bitwise AND operations to make any two array elements equal
- Check if all sub-numbers have distinct Digit product
- Gould's Sequence
- Check if suffix and prefix of a string are palindromes
- Find the winner of the game with N piles of boxes
- Check if the given number is Ore number or not
- Check whether a binary string can be formed by concatenating given N numbers sequentially
- Maximum number of fixed points using atmost 1 swap
- Largest element in the array that is repeated exactly k times
- Check if a pair with given product exists in Linked list
- Numbers that are bitwise AND of at least one non-empty sub-array
- Sub-strings having exactly k characters that have ASCII value greater than p
- Check if the frequency of all the digits in a number is same
- Sort prime numbers of an array in descending order
- Number of anomalies in an array
- All possible numbers of N digits and base B without leading zeros
- Minimum number of bottles required to fill K glasses
- Find two non-overlapping pairs having equal sum in an Array
- Online Queries for GCD of array after divide operations
- Triplet pair (a, b, c) such that a+b, b+c and a+c are all divisible by K
- Find minimum speed to finish all Jobs
- Permutation of an array that has smaller values from another array
- Python | range() does not return an iterator
- Find length of longest Fibonacci like subsequence
- Check if it is possible to rearrange a binary string with alternate 0s and 1s
- Check if there is any pair in a given range with GCD is divisible by k
- Get K-th letter of the decoded string formed by repeating substrings
- String after processing backspace characters
- Shift all prefixes by given lengths
- Maximizing the elements with a[i+1] > a[i]
- Count Magic squares in a grid
- Rearrange an array to maximize i*arr[i]
- String matching with * (that matches with any) in any of the two strings
- Minimize Cost with Replacement with other allowed
- String with frequency of characters in Lucas Sequence
- Convert all lowercase characters to uppercase whose ASCII value is co-prime with k
- Replace all consonants with nearest vowels in a string
- XOR of all Prime numbers in an Array
- Number of ways to partition a string into two balanced subsequences
- Minimum array elements to be changed to make it a Lucas Sequence
- Most frequent word in first String which is not present in second String
- Count of Prime Nodes of a Singly Linked List
- Check whether frequency of characters in a string makes Fibonacci Sequence
- Shortest distance to every other character from given character
- XOR of Prime Frequencies of Characters in a String
- Count pairs in an array such that frequency of one is at least value of other
- Count occurrences of the average of array elements with a given number
- Number of sub-arrays that have at least one duplicate
- Minimum number of elements to be replaced to make the given array a Fibonacci Sequence
- Check if frequency of character in one string is a factor or multiple of frequency of same character in other string
- Count subarrays with Prime sum
- Find all good indices in the given Array
- Ways to form n/2 pairs such that difference of pairs is minimum
- Different possible marks for n questions and negative marking
- Smallest prime number missing in an array
- Minimum and maximum node that lies in the path connecting two nodes in a Binary Tree
- Find the missing elements from 1 to M in given N ranges
- Print all pairs in an unsorted array with equal sum
- Count distinct pairs from two arrays having same sum of digits
- Find a value whose XOR with given number is maximum
- Number of blocks in a chessboard a knight can move to in exactly k moves
- Check if the given push and pop sequences of Stack is valid or not
- Count pairs (A, B) such that A has X and B has Y number of set bits and A+B = C
- Maximum sum subarray such that start and end values are same
- Closest greater or same value on left side for every element in array
- Find if there is any subset of size K with 0 sum in an array of -1 and +1
- Check if N can be represented as sum of integers chosen from set {A, B}
- Lexicographically Smallest Permutation of length N such that for exactly K indices, a[i] > a[i] + 1
- Count number of indices such that s[i] = s[i+1] : Range queries
- Maximize the median of an array
- Find a range that covers all the elements of given N ranges
- Fill missing entries of a magic square
- Level Order Successor of a node in Binary Tree
- Check if array can be sorted with one swap
- Print numbers with digits 0 and 1 only such that their sum is N
- Number of comparisons in each direction for m queries in linear search
- Replace the middle element of matrix with sum of surrounding elements
- Number of triangles that can be formed with given N points
- Level with maximum number of nodes using DFS in a N-ary tree
- Digits of element wise sum of two arrays into a new array
- Construct a binary string following the given constraints
- Move all special char to the end of the String
- Find the only different element in an array
- Puzzle | 1000 light bulbs switched on/off by 1000 persons passing by
- Minimum moves required to change position with the given operation
- Check if elements of an array can be arranged satisfying the given condition
- Find the minimum positive integer such that it is divisible by A and sum of its digits is equal to B
- Sum of first N natural numbers when N is extremely large
- Maximum possible time that can be formed from four digits
- Largest Divisor of a Number not divisible by a perfect square
- Find k-th character of decrypted string | Set - 2
- Summing the sum series
- Most frequent factor in a range of integers
- Program to print the given H Pattern
- Update adjacent nodes if the current node is zero in a Singly Linked List
- Find numbers a and b that satisfy the given conditions
- Count numbers < = N whose difference with the count of primes upto them is > = K
- Substring Reverse Pattern
- Sum of element whose prime factors are present in array
- Minimum K such that every substring of length atleast K contains a character c
- Minimum Operations to make value of all vertices of the tree Zero
- Sum of LCM(1, n), LCM(2, n), LCM(3, n), ... , LCM(n, n)
- Count of Numbers in a Range divisible by m and having digit d in even positions
- Check if a number is perfect square without finding square root
- Choose n elements such that their mean is maximum
- Pairs with same Manhattan and Euclidean distance
- Assign weights to edges such that longest path in terms of weights is minimized
- Check whether a + b = c or not after removing all zeroes from a,b and c
- Represent n as the sum of exactly k powers of two | Set 2
- Finding in and out degrees of all vertices in a graph
- Count rows in a matrix that consist of same element
- Print all integers that are sum of powers of two given numbers
- Possible cuts of a number such that maximum parts are divisible by 3
- Weighted sum of the characters of a string in an array | Set 2
- Cost to make a string Panagram | Set 2
- Check if it is possible to get back to 12'0 clock only by adding or subtracting given seconds
- Check if a string can be repeated to make another string
- Largest number less than or equal to N/2 which is coprime to N
- Reverse Middle X Characters
- Check if the binary representation of a number has equal number of 0s and 1s in blocks
- Replace each node with its Surpasser Count in Linked List
- Finding the path from one vertex to rest using BFS
- Count strings that end with the given pattern
- Find safe cells in a matrix
- Find the resulting Colour Combination
- Water Game
- Remove first X rows and columns from a matrix
- Divide N segments into two non-empty groups such that given condition is satisfied
- Minimum operations of given type to make all elements of a matrix equal
- Maximum given sized rectangles that can be cut out of a sheet of paper
- Generate a random permutation of 1 to N
- Count all Prime Length Palindromic Substrings
- Increasing sequence with given GCD
- Check if a binary string contains consecutive same or not
- Cost of painting n * m grid
- Count Odd and Even numbers in a range from L to R
- Find the lexicographically largest palindromic Subsequence of a String
- Make palindromic string non-palindromic by rearranging its letters
- Minimum number of edges between two vertices of a graph using DFS
- Sub-string that contains all lowercase alphabets after performing the given operation
- Minimum operations required to modify the array such that parity of adjacent elements is different
- Find the cordinates of the fourth vertex of a rectangle with given 3 vertices
- Minimum number of operations on an array to make all elements 0
- Sum of minimum elements of all possible sub-arrays of an array
- Maximum number of segments that can contain the given points
- Program to reverse a linked list using Stack
- Count possible moves in the given direction in a grid
- Shortest path to traverse all the elements of a circular array in increasing order
- Reverse zigzag Traversal of a Binary Tree
- Count of words that are present in all the given sentences
- Sum of XOR of all subarrays
- Delete nodes which have a greater value on right side using recursion
- DP on Trees | Set-3 ( Diameter of N-ary Tree )
- Print the first shortest root to leaf path in a Binary Tree
- Search element in a Spirally sorted Matrix
- Merge K sorted arrays of different sizes | ( Divide and Conquer Approach )
- Minimum edges to be added in a directed graph so that any node can be reachable from a given node
- Count of numbers between range having only non-zero digits whose sum of digits is N and number is divisible by M
- Zig-Zag traversal of a Binary Tree using Recursion
- Minimum operations to make counts of remainders same in an array
- Print All Leaf Nodes of a Binary Tree from left to right | Set-2 ( Iterative Approach )
- Find the Nth term of the series where each term f[i] = f[i - 1] - f[i - 2]
- Number of submatrices with OR value 1
- Minimum possible sum of array elements after performing the given operation
- Number of submatrices with all 1s
- Bitwise AND of N binary strings
- Number of unique paths in tree such that every path has a value greater than K
- Print the lexicographically smallest DFS of the graph starting from 1
- Maximum length of the sub-array whose first and last elements are same
- Longest Sub-array with maximum average value
- Sum of bitwise AND of all submatrices
- Sum of Bitwise-OR of all Submatrices
- Double Knapsack | Dynamic Programming
- Minimum operations to make frequency of all characters equal K
- Count pairs (p, q) such that p occurs in array at least q times and q occurs at least p times
- Number of special nodes in an n-ary tree
- Check if frequency of characters are in Recaman Series
- Character pairs from two strings with even sum
- Number of ways to select a node from each connected component
- Time until distance gets equal to X between two objects moving in opposite direction
- Sum of numbers from 1 to N which are in Fibonacci Sequence
- Minimum number of replacements to make the binary string alternating | Set 2
- Longest double string from a Palindrome
- Minimum number of bracket reversals needed to make an expression balanced | Set - 2
- Sum of the series (1*2) + (2*3) + (3*4) + ...... upto n terms
- Largest subset of rectangles such that no rectangle fit in any other rectangle
- Sum of nodes in top view of binary tree
- Find the K-th minimum element from an array concatenated M times
- Sum of all even factors of numbers in the range [l, r]
- Longest path in a directed Acyclic graph | Dynamic Programming
- Print the balanced bracket expression using given brackets
- Encrypt a string by repeating i-th character i times
- Count of all N digit numbers such that num + Rev(num) = 10^N - 1
- Sum of (maximum element - minimum element) for all the subsets of an array.
- Find A and B from list of divisors
- Character whose frequency is equal to the sum of frequencies of other characters of the given string
- Distinct state codes that appear in a string as contiguous sub-strings
- Sum of nodes in bottom view of Binary Tree
- Check if the given string is K-periodic
- Check if a Queen can attack a given cell on chessboard
- Smallest and Largest N-digit perfect cubes
- Addition of two numbers without propagating Carry
- Number of steps required to reach point (x,y) from (0,0) using zig-zag way
- Minimum cuts required to convert a palindromic string to a different palindromic string
- Find maximum N such that the sum of square of first N natural numbers is not more than X
- Generate all the binary strings of N bits
- Position of the K-th set bit in a number
- Find the number of good permutations
- Minimum length of square to contain at least half of the given Coordinates
- Maximum count of pairs which generate the same sum
- Count integers in a range which are divisible by their euler totient value
- Find foot of perpendicular from a point in 2 D plane to a Line
- Find a pair from the given array with maximum nCr value
- Minimum steps to delete a string by deleting substring comprising of same characters
- Maximum sum from three arrays such that picking elements consecutively from same is not allowed
- Count of buttons pressed in a keypad mobile
- Correct the Random Pointer in Doubly Linked List
- Check if the given binary tree has a sub-tree with equal no of 1's and 0's | Set 2
- Program to calculate Double Integration
- Maximize the value of the given expression
- Loss when two items are sold at same price and same percentage profit/loss
- Total distinct pairs of ugly numbers from two arrays
- Sort ugly numbers in an array at their relative positions
- Times required by Simple interest for the Principal to become Y times itself
- Iterative approach to check for children sum property in a Binary Tree
- Generate all binary strings of length n with sub-string "01" appearing exactly twice
- Length of the longest substring that do not contain any palindrome
- Arrange given numbers to form the smallest number
- Maximum Subarray Sum after inverting at most two elements
- Find number of edges that can be broken in a tree such that Bitwise OR of resulting two trees are equal
- Find the longest subsequence of an array having LCM at most K
- Sum of two numbers where one number is represented as array of digits
- Number of ways for playing first move optimally in a NIM game
- Number of ways of choosing K equal substrings of any length for every query
- Area of the biggest ellipse inscribed within a rectangle
- Minimum number of given operations required to convert a permutation into an identity permutation
- Find the count of sub-strings whose characters can be rearranged to form the given word
- Count all prefixes of the given binary array which are divisible by x
- Count consecutive pairs of same elements
- Iterative selection sort for linked list
- Print path from root to all nodes in a Complete Binary Tree
- Convert the undirected graph into directed graph such that there is no path of length greater than 1
- Find triplet such that number of nodes connecting these triplets is maximum
- Length of the longest substring with no consecutive same letters
- Find number of unique triangles among given N triangles
- Sum of all distinct nodes in a linked list
- Sum of smaller elements of nodes in a linked list
- Divide a number into two parts
- Check if the given Binary Expressions are valid
- Number of Positions to partition the string such that atleast m characters with same frequency are present in each substring
- Find the kth node in vertical order traversal of a Binary Tree
- Maximum length cycle that can be formed by joining two nodes of a binary tree
- Game Theory in Balanced Ternary Numeral System | (Moving 3k steps at a time)
- Kth largest node among all directly connected nodes to the given node in an undirected graph
- Maximum sum of non-leaf nodes among all levels of the given binary tree
- Sum of all parent-child differences in a Binary Tree
- Arrange array elements such that last digit of an element is equal to first digit of the next element
- Find an index such that difference between product of elements before and after it is minimum
- Maximum Sum SubArray using Divide and Conquer | Set 2
- Find sub-arrays from given two arrays such that they have equal sum
- Count number of subsets whose median is also present in the same subset
- Smallest multiple of N formed using the given set of digits
- Minimum number of given operations required to reduce the array to 0 element
- K-th ancestor of a node in Binary Tree | Set 3
- Sum of the mirror image nodes of a complete binary tree in an inorder way
- Count the number of primes in the prefix sum array of the given array
- Maximum possible middle element of the array after deleting exactly k elements
- Print the degree of every node from the given Prufer sequence