Skip to content

Category Archives: Divide and Conquer

Given two integers K, X, and an array arr[] consisting of N distinct elements, the task is to find X elements closest to the Kth… Read More
Given two integers N and M, generate a sequence of N binary strings by the following steps: S0 = “0” S1 = “1” Generate remaining… Read More
Given an array arr[] consisting of N integers, the task is to find all the array elements having frequency more than ⌊N/3⌋ in the given… Read More
What is the binary search algorithm? Binary Search Algorithm is used to find a certain value of x for which a certain defined function f(x) needs… Read More
There are 12 men on an island. 11 weigh exactly the same, but one of them is slightly lighter or heavier. There is a seesaw… Read More
Given a string S of Size N. Initially, the value of count is 0. The task is to find the value of count after N… Read More
Given a number N and any base B. The task is to check if N can be expressed in the form a1*b0 + a2*b1 +… Read More
Given an N-ary Tree rooted at 1, and an array val[] consisting of weights assigned to every node, and a matrix Q[][], consisting of queries… Read More
Given an array arr[] consisting of N integers, the task is to find the array K[] of minimum possible length such that after performing multiple… Read More
Given two arrays arr1[] and arr2[]. We can generate another array arr3[] by adding each element of the array arr1[] to each element arr2[]. The… Read More
Given an array arr[] consisting of integers and queries Q of the form (L, R), the task is to check whether any non-repeating element is… Read More
Given an array arr[] consisting of N integers, the task is to find the second largest element in the given array using N+log2(N) – 2… Read More
Given a numeric string S representing a large number, the task is to form a Fibonacci Sequence of at least length 3 from the given… Read More
Given a binary string str, the task is to check whether the given string follows the below condition or not:  String starts with a ‘1’.… Read More
Given the constants of quadratic equation F(x) = Ax2 + Bx + C as A, B, and C and an integer K, the task is… Read More