Constructive Algorithms - Basic Articles
Given two strings A and B of length N, the task is to check whether the two strings can be made equal by swapping any… Read More
Given two integers N and M, where N is the number of friends sitting in a clockwise manner in a circle and M is the… Read More
Given an integer N where 1 ≤ N ≤ 105, the task is to find the number of positive integers less than or equal to… Read More
Given an array Arr[]. The task is to count the number of elements Arr[i] in the given array such that one or more smaller elements… Read More
Given two sides of a triangle s1 and s2, the task is to find the minimum and maximum possible length of the third side of… 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 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[] 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 four integers a, b, c and d which signifies the number of four types of brackets.   “((“ “()” “)(“ “))” The task is to… Read More
Given an array arr[] of positive integers and an integer x, the task is to minimize the sum of elements of the array after performing… Read More
Given an array of N including positive and negative numbers only. The task is to find the length of the longest alternating (means negative-positive-negative or… Read More
Given two string A and B which represents two integers, the task is to print the maximized value of A after replacing 0 or more… Read More
Given a string str and an integer k. The task is to count the occurrences of sub-strings of length k that consist of the same… Read More
Given an array arr[] and an integer K, the task is to find whether the array can be divided into two sub-arrays such that the… Read More
Given a linked list. The task is to change the value of the previous and next node of a node to 0 if the current… Read More
Given the total number of Legs and Head of Rabbits and Pigeons. The task is to calculate the number of Rabbits and Pigeons. Examples:  Input:… Read More
Given N magnets are kept in a row one after another, either with a negative pole on the left and a positive pole on the… Read More
Given a number N. The task is to count the minimum number of digits to be removed from the number so that no two consecutive… Read More
Given two arrays of positive and distinct integers. The task is to find a pair from the two arrays with maximum sum. Note: The pair… Read More
Given a, b and c which are part of the equation x = b * ( sumdigits(x) ^ a ) + c.Where sumdigits(x) determines the… Read More