# Tag Archives: Binary Search

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
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 an array arr[] of size N, and integers M and K, the task is to find the maximum possible value of the smallest array… Read More
Given an array arr[] of size N, and integers 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 a tree consisting of N nodes and rooted at node 1, also given an array Q[] of M pairs, where each array element represents… Read More
Given three numbers W, B, and O representing the quantities of white, black, and other colors shirts respectively, the task is to find the maximum… Read More
The in-built STL library function binary_search() for searching whether a given string is present or not in the given string array. Binary search is a… Read More
Given N candies, M people, and an array arr[] of M positive integers, the task is to find the minimum value of K such that… Read More
Given an array arr[] of size N, consisting of distinct elements, the task is to count the number triplets such that (arr[j] – arr[i]) ≤… Read More
Given two integers W and C, representing the number of watermelons and coins, the task is to find the maximum number of mangoes that can… Read More
Given two arrays arr1[] and arr2[] consisting of N and M integers respectively, the task is to find the probability of randomly selecting the two… Read More
Given a sorted array arr[] of size N and an integer K, the task is to find Kth smallest element present in the array. The… Read More