Skip to content

Category Archives: Greedy

Given a binary array arr[] of size N and an integer K, the task is to check whether the binary array can be turned into… Read More
Given two integers N and M, the task is to find the Mth lexicographically smallest binary string (have only characters 1 and 0) of length… Read More
Given an array arr[] of N integers and an integer K, the task is to find the GCD of all the array elements except the… Read More
Given an array of arr[] of N integers, the task is to find the minimum number of moves to sort the array in non-decreasing order… Read More
Given a directed binary tree of N nodes whose edges are directed from the parent to the child, the task is to count the number… Read More
Given an array arr[], the task is to find the minimum number of deletion operations required such that: The newly created array should have an… Read More
Given a binary array arr[] of size N, and an integer K, the task is to calculate the number of ways to partition the array… Read More
Given an array arr[] of size N and an integer K, the task is to find the minimum operations such that no variable is divisible… Read More
Given an array arr[] of size N, the task is to minimize the array sum after replacing array elements with positive integers in a way… Read More
Given an array arr[] containing N integers, the task is to check whether the array is monotonic or not (monotonic means either the array is… Read More
Given a binary string S of length N, the task is to minimize the count of operations required to find a binary string T of… Read More
Given, a binary tree, the task is to convert this tree using minimum number of increment-decrement operations into a tree which satisfies the following conditions:… Read More
Given an integer N, the task is to construct and print an Array, such that: The size of array is N The elements in array… Read More
Given an array arr[] of size N, and an integer K, the task is to maximize the first element of the array in K operations… Read More
Given a string S of length N, the task is to find the length of the longest substring X of the string S such that:… Read More

Start Your Coding Journey Now!