Given an array, arr[] of N distinct integers and an integer K, the task is to rearrange the given array in such a way, that… Read More

# Category Archives: Searching

Given an array arr[] and brr[] both consisting of N integers and a positive integer K, the task is to find the minimum value of… Read More

Given a complete binary tree with values indexed from 1 to N and a key K. The task is to check whether a key exists… Read More

Given a binary string str[] of size N and an integer M. This binary string can be modified by flipping all the 0’s to 1… Read More

Given a rectangle of length L and breadth B, the task is to print the maximum integer altitude possible of the largest triangle that can… Read More

Given a sorted array, arr[] consisting of N integers, the task is to find the frequencies of each array element. Examples: Input: arr[] = {1,… Read More

The word “prune” means to reduce something by removing things that are not necessary. So, Prune-and-Search is an excellent algorithmic paradigm for solving various optimization… Read More

Given an array arr[] of size N, the task is to find the maximum index i such that arr[i] is equal to i. If there… Read More

Given an array arr[] of size N, and intgers L and R, the task is to count the number of pairs [arri , arrj] such… Read More

Given an array arr[] consisting of N integers and two integers L and R, the task is to count the number of pairs whose sum… Read More

Given a square matrix arr[][] of size N consisting of non-negative integers and an integer K, the task is to find the maximum median value… Read More

Given two integers X, K, and two arrays arr[] and R[] both consisting of N positive integers where R[i] denotes the amount by which arr[i]… Read More

Given an array arr[] consisting of N positive integers, the task is to find the number of pairs (i, j) such that i < j… Read More

Given a binary string S of length N, the task is to find lexicographically the smallest string formed after modifying the string by selecting any… Read More