# Category Archives: Greedy

Given an array A[] of N elements, the task is to create a Prefix-MEX array for this given array. Prefix-MEX array B[] of an array… Read More
Given a binary string S, the task is to find the longest subsequence with that has equal number of 0s and 1s and all the… Read More
Given an array of jumps[] of length N, where each element denotes the maximum length of a jump forward from each index. The task is… Read More
Given N pairs of integers, each integer is between 1 to M, the task is to check if there exist two integers x and y… Read More
Given two arrays arr1[] and arr2[] of length N each and an integer K, The task is to maximize the number of equal elements at… Read More
Given a string S and a list of strings subs[] that stores the substrings of S and all the substrings are present only once, the… Read More
Given a 2D matrix of size N x M and Q queries where each query represents a coordinate (x, y) of the matrix, the task… Read More
Given two arrays arr1[] and arr2[] of sizes N and M and an integer K, the task is to find the maximum possible sum pair… Read More
A bike race is being organised with N bikers. The initial speed and the acceleration of the bikers are given in arrays H[] and A[]… Read More
Given an integer K and an array arr[] of N integers, the task is to find the maximum number that can be added or subtracted… Read More
Given a string S on which you need to perform Q replace operations.Each replacement operation has 3 parameters: a starting index i, a source word… Read More
Given a string str consisting of N letters, the task is to find the total number of strings that can be generated by replacing each… Read More
Given an array arr[], consisting of N integers, the task is to find the minimum number of moves required to make all numbers in the… Read More
Given an array A[] of length N, the task is to count the number of subarrays of A[] that contain the length of that subarray.… Read More
Given a string S of size N, having lowercase alphabets, the task is to find the lexicographically minimum string after moving a subsequence to the… Read More