# Category Archives: Divide and Conquer

Given an array arr[] consisting of N integers representing the number of coins in each pile, and an integer H, the task is to find… Read More
Given an array arr[] of length N and an integer K, the task is to count the number of pairs (i, j) such that i… Read More
Given an array arr[] of size N and an integer K, the task is to find all the array elements that appear more than (N… Read More
Given a positive integer N, the task is to construct an array a[] using first N natural numbers which contains no such triplet (i, j,… Read More
Given an array arr[] of size N (always power of 2), the task is to find the length of the longest sorted array to which… Read More
Given an array wood[] of size N, representing the length of N pieces of wood and an integer K, at least K pieces of the… Read More
Given two sorted arrays, arr[], brr[] of size N, and M, the task is to merge the two given arrays such that they form a… Read More
Given two sorted arrays, arr[], brr[] of size N, and M, the task is to merge the two given arrays such that they form a… Read More
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 which occurs more than floor (n/3) times. Examples:… 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