Skip to content

Category Archives: Greedy

Given an array arr[] consisting of N integers, the task is to find the maximum count of decreasing subsequences possible from an array which satisfies… Read More
Given an array arr[] consisting of N integers, the task is to find the array K[] of minimum possible length such that after performing multiple… Read More
Given a palindromic string S, the task is to find the count of palindromic strings possible by swapping a pair of character at a time.Examples:… Read More
Given two arrays arr1[] and arr2[]. We can generate another array arr3[] by adding each element of the array arr1[] to each element arr2[]. The… Read More
Given two integers N and K, the task is to find the count of all possible N-digit numbers having sum of every K consecutive digits… Read More
Given a positive integer N, the task is to find the sum of the product of all the integers in the range [1, N] with their… Read More
Given an integer N, the task is to find two numbers a and b such that a / b = N and a – b… Read More
Given an array A[] of N integers and an integer K, the task is to select the maximum number of elements from the array whose… Read More
Given an integer K, the task is to find a pair of numbers (A, B) such that A – B = K and A /… Read More
Given a natural number N, the task is to find a number M smaller than N such that the difference between their bitwise XOR (N… Read More
Given a number N and a time X unit, the task is to find the number of containers that are filled completely in X unit… Read More
Given two integers N and M, where N denotes the count of ‘0’ and M denotes the count of ‘1’, and an integer K, the… Read More
Given a character C and a string S, the task is to remove the first and last occurrence of the character C from the string… Read More
Given two integers N and M, the task is to construct a binary string with the following conditions :  The Binary String consists of N… Read More