# Tag Archives: Constructive Algorithms

Two players A and B are playing NIM Game with each other. Both are playing optimally. Player A starts the game. The task is to… Read More
Given an array arr[] of N integers, the task is to find the count of unordered index pairs (i, j) such that i != j… Read More
Given an array arr[] containing GCD of every possible pair of elements of another array. The task is to find the original numbers which are… Read More
Given an integer X. The task is to find the number of jumps to reach a point X in the number line starting from zero. Note:… Read More
Given an array arr[] of strings of equal lengths. The task is to calculate the total number of pairs of strings which differ in exactly… Read More
Given a string str consisting only of the characters ‘a’, ‘b’ and ‘c’, find the number of sub-strings that do not contain all the three… Read More
Given the position of the king on an 8 X 8 chessboard, the task is to count the total number of squares that can be… Read More
Given an array arr[] of size n where arr[i] is the number of candies of type i. You have an unlimited amount of money. The… Read More
Given an array arr[] of n integers and an integer k. The task is to maximize the sum of the array after performing the given… Read More
Given an array of N integers which denotes the edges of N cubical structures respectively. Also given are M integers which denote the number of… Read More
Given an array that represents a tree in such a way that array indexes are values in tree nodes and array values give the parent… Read More
Given a string str consisting of characters and numbers and an integer k, the task is to decrypt the string and the return the kth… Read More
Given an array arr[] of N elements and an integer K where K < N. The task is to insert K integer elements to the… Read More
Given an array arr[] of N integers and an integer K, the task is to find whether the given array elements can be made 0… Read More
Given the integer values of N and K. The task is to find the number of pairs from the set of natural numbers up to… Read More