Given two integers N and K (K ≤ N), the task is to obtain a string of length N such that maximum length of a… Read More

# Category Archives: Greedy

Given a Binary string str of length N, the task is to find the last character removed from the string by repeatedly removing the first… Read More

Given two arrays, arr[] and brr[] of size N and M respectively, the task is to find the count of pairs (arr[i], brr[j]) such that… Read More

Given an array arr[] of size N and an integer K, the task is to find all the array elements that appear more than (N… Read More

Given two arrays A[] and B[] of size N and an integer K, the task is to check if all possible subset-sums of subsets of… Read More

Given six positive integers representing the Bitwise XOR and Bitwise AND of all possible pairs of a triplet (a, b, c), the task is to… Read More

Given a circular array arr[] of size N and two integers K and M, the task is to sort M array elements starting from the… Read More

Given two positive integers N and X, the task is to construct N positive integers having Bitwise XOR of all these integers equal to K.… Read More

Given two arrays A[], consisting of N integers, and B[], consisting of taste values of M chocolates and an integer X, the task is to… Read More

Given a positive integer N, the task is to find the number that can be obtained by flipping consecutive set bits starting from the LSB… Read More

Given an array arr[] of size N, the task is to find the maximum frequency of any array element by incrementing or decrementing each array… Read More

Given a 2D array arr[][] with each row of the form { X, Y }, where Y and X represents the minimum cost required to… Read More

Given an array arr[] of size N, the task is to find the minimum count of array elements required to be removed such that frequency… Read More

Given a string S, the task is to count all possible strings that can be generated by placing spaces between any pair of adjacent characters… Read More