Skip to content

Category Archives: Searching

Given an array arr[] of N integers along with integers M, L, R. Consider a variable S(initially 0). The task is to find the maximum… Read More
Given a string S of size N consisting of lowercase alphabets only, the task is to find the smallest character having a minimum sum of… Read More
Given an array arr[] of N positive integers, the task is to find the subarray having maximum sum among all subarrays having unique elements and… Read More
Given two integers L and R, the task is to count the numbers having only one unset bit in the range [L, R]. Examples: Input:… Read More
Given a binary string S of length N and an even integer K, the task is to check if all substrings of length K contains… Read More
Given a string S, the task is to find the sum of distances between all pairs of indices from the given string which contains the… Read More
Given an array A[] consisting of N integers from a range [1, N], the task is to calculate the count of array elements (non-distinct) that… Read More
Given an array A[] consisting of N integers and an integer K, the task is to maximize the length of the subarray having equal elements… Read More
Given a positive integer N > 1, the task is to find the maximum GCD among all the pairs (i, j) such that i <… Read More
Given an N-ary Tree rooted at 1, the task is to find the difference between the sum of nodes at the odd level and the… Read More
Given a tree with N vertices numbered from 0 to N – 1, M edges, and Q queries of the form {U, V}, such that… Read More
Given a matrix arr[][] of dimensions N * M, having elements 0, 1, and 2. There is only one cell with value 1 present in… Read More
Given an array arr[] of N integers and a positive integer K, the task is to check if it is possible to split this array… Read More
Given an array arr[] consisting of N integers, read every element of the array one by one and perform the following operations: If the current… Read More
Given string str of size N, the task is to remove the characters present at odd indices (0-based indexing) of a given string. Examples : … Read More