Skip to content

Category Archives: Algorithms

Given an array arr[ ] of size N, The array is sorted except one element. position pos of misplaced element is given, the task is… Read More
Given an array arr[] of N integers, an integer K, and Q queries of the type as explained below: (1, L, R): If the query… Read More
Given a string S consisting of only ‘0’, ‘1’ and ‘?’, the task is to check if there exists a substring “10” in every possible… Read More
Given an array arr[] of non-negative integers, the task is to check whether all array elements can be reduced to the minimum element in the… Read More
Given two positive integers N and K, the task is to find the mean of the minimum of all possible subsets of size K from… Read More
Given a positive integer N, the task is to find the number of integers X such that after performing the following sequence of operations reduces… Read More
Given an undirected and unweighted graph of N nodes and M edges, the task is to count the minimum length paths between node 1 to… Read More
Given two positive integers N and K, the task is to count the number of even and odd integers consisting of N bits, out of… Read More
Given an integer N, find a prime number S such that all digits of N occur in a contiguous sequence. There may be multiple answers.… Read More
Given a binary string S of size N, the task is to find the minimum cost by swapping every set bit with an unset bit… Read More
Given an array arr, replace any one element in array with any other integer. The task is to return the maximum number which divides all… Read More
Given an array arr consisting of N unique integers, the task is to rearrange the array such that element at index i of array should… Read More
Given an array of integers size n, find maximum number of pairs from array such that their sum is odd, by changing at most one… Read More
Given two integer coordinates (X1,  Y1) and (X2, Y2) and two positive integers K1 and K2, the task is to check if both the coordinates… Read More