Category Archives: Greedy

Given an array, arr[] consisting of N integers representing coordinates on a number line and an integer S. Find the maximum size of jump required… Read More
Given N number of cars and an integer D i.e distance of the destination. All the cars start from the same starting point moving towards… Read More
Given two binary strings s1 and s2. The task is to choose substring from s1 and s2 say sub1 and sub2 of equal length such… Read More
Given an array arr[] of length N, the task is to find the original array such that every ith element in the given array(arr[i]) is… Read More
Given two positive integers N and K. The task is to find the Kth number that can be written as the sum of different non-negative… Read More
Given an array arr[] consisting of integers. The task is to find minimum deletions required to remove the initial minimum and maximum element from arr[].NOTE:… Read More
Given an array arr[] of size N and an integer X, the task is to find the length of the longest subsequence such that the… Read More
Given an array arr containing N unique integers. The task is to calculate the minimum number of deques required to make the array sorted. Example: … Read More
Given a matrix mat[][] of dimensions N*M and an array target[] of M integers, the task is to check whether any row of the matrix… Read More
Given numeric string S of size N and a positive integer K, the task is to find the minimum number of adjacent swaps required in… Read More
Given an array arr[] of N integers and a positive integer K, the task is to find the minimum number of operations required to reduce… Read More
Given an array arr[] of N integers, the task is to find the number of pairs of array elements (arr[i], arr[j]) such that the difference… Read More
Given a positive integer K and an array arr[] consisting of {numerator, denominator} of N fractions, the task is to find the sum of the… Read More
Given two positive integers L and R and a binary string S of size N, the task is to check if the end of the… Read More
Given two binary matrices A[] and B[] of dimension N * M and a positive integer K, the task is to find the minimum number… Read More