# Category Archives: Algorithms

Given three numbers A, B, and K where K is 0 initially. The task is to find the minimum operations to convert K into B… Read More
Given an array arr[] of size N and an integer K, one can move from an index i to any other index j such that… Read More
Given the number D, find the smallest number N such that it has exactly four divisors and the difference between any two of them is… Read More
Two players X and Y are picking up numbers alternatively with X picking first. In the first turn X picks 1, then Y picks 2,… Read More
Given an array arr[] of N integers and an integer K, the task is to calculate the minimum cost by spilling the array elements into… Read More
Given a binary array arr[]. The task is to find the position of any 0 in arr[] such that the distance between two set bits… Read More
Given a binary tree and an integer K, the task is to print all the nodes having children with the same remainder when divided by… Read More
Given a binary tree and an integer K. The task is to count the number of nodes having children that give the same remainder when… Read More
Given an array arr[] containing integers. The task is to find the largest positive integer x missing from the array such that min(arr[]) < x… Read More
Given an array arr[]. The task is to minimize the cost of reducing the array with a given operation. In one operation choose two elements… Read More
Given an array arr[], the task is to find the count of elements in the given array such that there exists an element strictly smaller… Read More
Given an array arr[]. The task is to count elements in the array that appears only once and it’s consecutive next (arr[i]+1) and prev (arr[I]… Read More
Given an integer N, the task is to find all N digit integers with sequential digits Examples: Input: N = 4Output: {1234, 2345, 3456, 4567,… Read More
Given a linked list lis of length N, the task is to determine the maximum distance between two consecutive peaks of the given linked list.… Read More
Given an array arr[] of size N, the task is to find the last remaining element of the array after consecutively removing the 1st and… Read More