Skip to content

Category Archives: Greedy

Given three binary strings a, b, and c each having 2*N characters each, the task is to find a string having almost 3*N characters such… Read More
Given string s denoting a number. The task is to find the minimum number that can be formed after replacing two consecutive digits of s… Read More
Given an array arr[] containing N positive integers, the task is to minimize the total count of peaks (elements having greater value than both the… Read More
Given an array arr[] of N positive integers, the task is to find the smallest possible value of the last remaining element in the array… Read More
Given three numbers A, B, and K where K is 0 initially. The task is to find the minimum operations to convert K into B… Read More
Two players X and Y are picking up numbers alternatively with X picking first. In the first turn X picks 1, then Y picks 2,… Read More
Given an array arr[] of N integers and an integer K, the task is to calculate the minimum cost by spilling the array elements into… Read More
Given a binary array arr[]. The task is to find the position of any 0 in arr[] such that the distance between two set bits… Read More
Given an array arr[]. The task is to minimize the cost of reducing the array with a given operation. In one operation choose two elements… Read More
Given an array arr[], the task is to find the count of elements in the given array such that there exists an element strictly smaller… Read More
Given a linked list lis of length N, the task is to determine the maximum distance between two consecutive peaks of the given linked list.… Read More
Given two arrays A[] and B[] of size N each, the task is to minimize A[i] + B[j] such that j ≥ i. Examples: Input:… Read More
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array… Read More
Given non-negative integers K, M, and an array arr[ ] consisting of N elements, the task is to find the Mth element of the array… Read More

Start Your Coding Journey Now!