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

# Category Archives: Greedy

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

Given an array A[ ] consisting of N positive integers, such that each array element Ai denotes the count of elements of ith type, the… Read More

Given an integer target and an array arr[] consisting of N positive integers where arr[i] denotes the time required to score 1 point for the… Read More

Given an array arr[] of size N and an integer K, the task is to check if all array elements can be made equal by… Read More

Given two positive integers K and X, the task is to find the minimum possible sum of K positive integers ( repetitions allowed ) having… Read More

Given an array weights[] consisting of N positive integer, where weights[i] denotes the weight of ith node, the task is to construct an N-ary tree… Read More

Given two strings S and T, the task is to count the number of substrings of S that contains string T in it as a… Read More

Given a positive integer N, the task is to construct an array a[] using first N natural numbers which contains no such triplet (i, j,… Read More

Given a binary string S of length N, the task is to print the minimum number of indices, substrings consisting only of 1s are required… Read More

Given two integers X and Y, representing Bitwise XOR and Bitwise AND of two positive integers, the task is to calculate the Bitwise OR value… Read More