Skip to content

Tag Archives: Constructive Algorithms

Given an array of N elements and you can perform two operations on it: Increase any of the array element by X once. Decrease any… Read More
Given a binary array of N elements and two initial values a and b. We can cross the i-th element if:   If a[i] == 0,… Read More
Given a total amount of N and unlimited number of coins worth 1,  10 and 25 currency coins. Find out the minimum number of coins you need to use… Read More
Given an array arr[] of random integers, the task is to push all the zero’s in the array to the start and all the one’s… Read More
Given an array arr[] of N positive integers. The task is to find the maximum possible value of a[i] % a[j] over all pairs of… Read More
Given a merged sequence which consists of two sequences which got merged, one of them was strictly increasing and the other was strictly decreasing. Elements… Read More
Given an array arr[] of N elements. At any step, we can delete a number of a different parity from the just previous step, i.e.,… Read More
Given a 2D matrix mat[][], the task is to find the maximum sum of a cocktail glass.   A Cocktail glass is made of 6 cells… Read More
Given an array of N elements. The task is to split the elements into two arrays say a1[] and a2[] such that one contains strictly… Read More
Given an integer N containing the digit 4 at least once. The task is to divide the number into two parts x1 and x2 such… Read More
Given a string str, the task is to find the length of the longest sub-string which does not have any pair of consecutive same characters. Examples:  … Read More
Given a binary array of N numbers. The task is to find the smallest index such that there are either no 1’s or 0’s to… Read More
Given an array arr[], the task is to count the number of pairs formed by consecutive elements in which both of the elements in a… Read More
Given a string str and Q queries. Each query consists of an integer K. The task is to find the number of ways of choosing… Read More

Start Your Coding Journey Now!