## Longest subsequence having difference atmost K

Given a string S of length N and an integer K, the task is to find the length of longest sub-sequence such that the difference… Read More »

- Coin Change | BFS Approach
- Minimum time required to rot all oranges | Dynamic Programming
- Partition an array of non-negative integers into two subsets such that average of both the subsets is equal
- Count of integers of length N and value less than K such that they contain digits only from the given set
- Maximum sum combination from two arrays
- Flip minimum signs of array elements to get minimum sum of positive elements possible
- Divide the array in K segments such that the sum of minimums is maximized
- Minimum number of Fibonacci jumps to reach end
- Number of shortest paths to reach every cell from bottom-left cell in the grid
- Mobile Numeric Keypad Problem | Set 2
- Optimally accommodate 0s and 1s from a Binary String into K buckets
- Sum of the distances from every node to all other nodes is maximum
- Maze With N doors and 1 Key
- Number of Subsequences with Even and Odd Sum
- Maximum number of given operations to remove the entire string
- Find minimum length sub-array which has given sub-sequence in it
- Probability of getting more heads than tails when N biased coins are tossed
- Maximum Sequence Length | Collatz Conjecture
- Alternate XOR operations on sorted array
- Cost Based Tower of Hanoi
- Optimal Strategy for a Game | Set 3
- Subsequence X of length K such that gcd(X[0], X[1]) + (X[2], X[3]) + ... is maximized
- Longest subsequence such that every element in the subsequence is formed by multiplying previous element with a prime
- Count number of ways to get Odd Sum
- Divide an array into K subarray with the given condition
- Counts Path in an Array
- Count numbers in given range such that sum of even digits is greater than sum of odd digits
- Minimum increment or decrement operations required to make the array sorted
- Partition the array in K segments such that bitwise AND of individual segment sum is maximized
- Remove an element to maximize the GCD of the given array

Given a string S of length N and an integer K, the task is to find the length of longest sub-sequence such that the difference… Read More »

Given three vertices U, V and R of a binary tree, the task is to check whether R lies in the path between U and… Read More »

Given a vertex V of an N-ary tree and an integer K, the task is to print the Kth ancestor of the given vertex in… Read More »

Given two integers N and K, the task is to calculate the number of integers in the range [0, N] whose digit sum is a… Read More »

Given an array arr[] of size N. The task is to find the maximum subarray sum possible after performing the given operation at most once.… Read More »

Given a binary string str and an integer K, the task is to find the minimum cost required to partition the string into exactly K… Read More »

Given a matrix of N rows and M columns. It is given that M is a multiple of 3. The columns are divided into 3… Read More »

Given an array arr[] of size N > 1. The task is to find the maximum possible GCD of the array by replacing at most… Read More »

Given an array arr[] of size N, the task is to find the maximum sum of the elements of the array after applying the given… Read More »

Given an array arr[] of N non-negative integers and an integer 1 ≤ K ≤ N. The task is to find the sum of the… Read More »

Given two arrays S[] and T[] of size N and M respectively. The task is to find the pairs of subsequences of S[] and subsequences… Read More »

Given an array arr[] of N elements and a positive integer K such that K ≤ N. The task is to find the number of… Read More »

Given an array arr[] of size N and an integer K. Array represents the broken steps in a staircase. One can not reach a broken… Read More »

Given a sequence arr of N positive integers, the task is to find the length of the longest subsequence such that xor of adjacent integers… Read More »

Given N ropes, each rope has a length associated with it. At a time, only two consecutive small ropes tied at end form a large… Read More »