# Category Archives: Greedy

Given an array Arr[] of size N, the cost of removing ith element is Arr[i]. The task is to remove the maximum number of elements… Read More
Given an array A, the task is to find elements with the occurrence at least K times the frequency of the least occurring element in… Read More
Given a string S consisting of only lowercase English letters of length N, the task is to find the count of substrings such that each… Read More
Given a number N, the task is to find the minimum number X such that A(X) = N, where A(X) for positive integer X is… Read More
Given an integer array A[] of length N (N >= 1), the task is to print the total number of indices in the array that… Read More
Given two integers L and R, construct an array of given size N such that the GCD (Greatest Common Divisor) of the element with their… Read More
Given an array arr[] of size N, the task is to find the minimum moves to segregate even and odd numbers by swapping two adjacent… Read More
Given an array A[] of size N, the task is to maximize the frequency of any element by adding any positive integer X to all… Read More
Given an array A[] of N integers, the task is to find the lexicographically smallest subsequence of the array by deleting all the occurrences of… Read More
Given an array arr[] of size N, the task is to find the minimum number of operations required to reduce all three elements of the… Read More
Given an array arr[] of length N and an integer M, the task is to determine if a strictly increasing sequence can be formed by… Read More
Given two integers M and N the task is to construct a binary palindromic string consisting of M occurrences of 0s and N occurrences of… Read More
Given two arrays of strings A[] and B[] containing only small case letters, the task is to count the number of strings in A[] such… Read More
Given an array of non-negative integers arr[] and an integer K, the task is to minimize the product of array elements by performing at K… Read More
Given a string S of size M consisting of only zeroes (and hence representing the integer 0). Also, given an array A[] of size N… Read More