Category Archives: Greedy

Given two positive integers N and K, the task is to find the smallest number whose sum of digits is N and every distinct digit… Read More
Given two arrays A[ ] and B[ ] consisting of N integers, where Ai denotes the quantity of sweets of the ith type and Bi… Read More
Given an array arr[] consisting of N positive integers, the task is to find the sum of all the array elements required to be subtracted… Read More
Given a positive integer N, the task is to find the smallest positive number made up of distinct digits having sum of its digits equal… Read More
Given a numeric string S representing a positive decimal integer, the task is to find the minimum number of positive Deci-Binary numbers required to obtain… Read More
Given two integers N and M, the task is to count all possible pair of integers (i, j) (1 ≤ i ≤ N, 1 ≤… Read More
Given two arrays A[] and B[] consisting of N integers, the task is to count pairs (A[i], B[j]) with even and odd product and print… Read More
Given two strings S1 and S2 of length N and M respectively, the task is to find the maximum value of times the string S2… Read More
Given two intgers N and K (K ≤ N), the task is to obtain a string of length N such that maximum length of a… Read More
Given a Binary string str of length N, the task is to find the last character removed from the string by repeatedly removing the first… Read More
Given two arrays, arr[] and brr[] of size N and M respectively, the task is to find the count of pairs (arr[i], brr[j]) such that… Read More
Given an array arr[] of size N and an integer K, the task is to find all the array elements that appear more than (N… Read More
Given two arrays A[] and B[] of size N and an integer K, the task is to check if all possible subset-sums of subsets of… Read More
Given six positive integers representing the Bitwise XOR and Bitwise AND of all possible pairs of a triplet (a, b, c), the task is to… Read More
Given a circular array arr[] of size N and two integers K and M, the task is to sort M array elements starting from the… Read More