# Category Archives: Searching

## Largest subset having with sum less than equal to sum of respective indices

Given an array arr[], the task is to find the length of the largest subset with the sum of elements less than or equal to… Read More »

## Min difference between maximum and minimum element in all Y size subarrays

Given an array arr[] of size N and integer Y, the task is to find a minimum of all the differences between the maximum and… Read More »

## Least root of given quadratic equation for value greater than equal to K

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 »

## Queries for count of array elements with values in given range with updates

Given an array arr[] of size N and a matrix Q consisting of queries of the following two types: 1 L R : Print the… Read More »

## Median of sliding window in an array | Set 2

Prerequisites: Policy based data structure, Sliding window technique. Given an array of integer arr[] and an integer K, the task is to find the median… Read More »

## Longest subarray with difference exactly K between any two distinct values

Given an array arr[] of length N and an integer K, the task is to find the longest subarray with difference between any two distict… Read More »

## Kth diagonal from the top left of a given matrix

Given a squared matrix M[ ][ ] of N * N dimensions, the task is to find the Kth diagonal of the matrix, starting from… Read More »

## Construct a sequence from given frequencies of N consecutive integers with unit adjacent difference

Given an array freq[] which stores the frequency of N integers from 0 to N – 1. The task is to construct a sequence where… Read More »

## Minimum distance between any most frequent and least frequent element of an array

Given an integer array arr[] of size N, the task is to find the minimum distance between any most and least frequent element of the… Read More »

## Print all numbers in given range having digits in strictly increasing order

Given two postive integers L and R, the task is to print the numbers in the range [L, R] which have their digits in strictly… Read More »

## Construct a string that has exactly K subsequences from given string

Given a string str and an integer K, the task is to find a string S such that it has exactly K subsequences of given… Read More »

## Replace each element of Array with it’s corresponding rank

Given an array arr[] of N integers, the task is to replace each element of Array with their rank in array. The rank of an… Read More »

## Find pairs in array whose sum does not exist in Array

Given an array arr[] consisting of N positive integers, the task is to print all pairs of array elements whose sum does not exist in… Read More »

## Largest subset with M as smallest missing number

Given an array arr[] of N positive integers and a positive integer M, the task is to find the length of longest subset whose smallest… Read More »

## Find the node at the centre of an N-ary tree

Prerequisites: Diameter of a N-ary tree Path between two nodes in a graph Given a N-ary tree with N nodes numbered from 0 to N-1… Read More »