Skip to content

Category Archives: Greedy

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
Given an array arr[] of N integers such that no element is 0 in that array, the task is to find the minimum number of… Read More
Given an array A[] of N integers, the task is to find the number of pairs of indices (1 ≤ i, j ≤ N) in… Read More
Given a string S that consists of only alphanumeric characters and dashes. The string is separated into N + 1 groups by N dashes. Also… Read More
Given two arrays A[] and B[] of the same length N. the task is to find a pair (X, Y) for two numbers Ai (number… Read More
Given a string S consisting of lower case letters and an integer K, the task is to remove minimum number of letters from the string,… Read More
Given an array A[] of length N, the task is to minimize the maximum frequency of any array element by performing the following operation only… Read More
Given an array arr[] of size N. The task is to make all the array elements equal to zero by applying the minimum number of… Read More
Given an array arr[] which is of 3*N size, the task is to remove N elements and divide the whole array into two equal parts… Read More
Given two arrays, array A[] of size N and array B[] of size N-1, array A has all the positive elements and -1 for the… Read More
Given a binary string S of length N, the task is to find the minimum number of removals to segregate all the 0s and all… Read More
Given a weighted directed graph with N vertices and M edges, a source src and a destination target, the task is to find the shortest… Read More
Given an array A[] of size N. The task is to find the minimum value that should be added to the array elements to maximize… Read More
Given an array A[] of size N, the task is to check if there exists any integer that divide all the elements of that array… Read More

Start Your Coding Journey Now!