Skip to content

Tag Archives: Greedy Algorithms

Given a positive integer N representing the count of players playing the game. The game is played between two teams such that each team consists… Read More
Given two arrays arr[] and brr[] of size N and M respectively, the task is to count the maximum number of elements that can be… Read More
Given an array arr[] of size N, the task is to empty given array by removing 2i – 1 array elements in each operation (i… Read More
Given an array arr[] of size N and an integer D, the task is to make all array elements equal by incrementing or decrementing minimum… Read More
Given an infinite number line from the range [-INFINITY, +INFINITY] and an integer N, the task is to find the minimum count of moves required… Read More
Given two arrays S[] and E[] of size N denoting starting and closing time of the shops and an integer value K denoting the number… 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 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 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 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 circular array arr[] consisting of N integers, the task is to print the Next Greater Element for every element of the circular array.… Read More
Given a binary string, str, the task is to empty the given string by minimum number of removals of a single character or a subsequence… Read More
Given two strings S and P, the task is to find the largest palindrome possible string by choosing characters from the given strings S and… Read More
Given an array arr[] of size N, the task is to find the minimum number of increment or decrement operations required at any index i… Read More
Given an array arr[] of size N, the task is to find the maximum possible sum of the array elements such that the element can… Read More

Start Your Coding Journey Now!