Skip to content
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 a stack of integers and an integer K, the task is to sort the elements of the given stack using another stack in 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 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 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 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 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 two integers N and K, the task is to generate a permutation of N numbers (Every number from 1 to N occurs exactly once)… Read More
Given N magnets kept in a row one after another, either with a negative pole on the left and a positive pole on the right… 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 should… Read More
Given two binary strings. The task is to check if string s1 can be converted to string s2 by performing the given operations any number… Read More