Skip to content

Category Archives: Searching

Given an array arr[] consisting of N distinct integers, the task is to find the number of subarrays which contains both the maximum and the… Read More
Given an integer N, the task is to find the number of prime numbers up to N that can be expressed as a sum of… Read More
Given a string S of valid parentheses sequence of length N and an even integer K, the task is to find the valid parentheses sequence… Read More
Given an N-ary tree and an integer K, the task is to print the Kth ancestors of all the nodes of the tree in level… Read More
Given a Binary Tree, the task is to find the node from the given tree which has the maximum number of nodes in its subtree… Read More
Given a binary tree and an integer K, the task is to count the possible pairs of leaf nodes from the given binary tree such… Read More
Given two arrays arr[] and query[] of sizes N and Q respectively and an integer M, the task for each query, is to count the… Read More
Given a matrix mat[][] of dimensions N * M, the task is to find the path from the top-left cell (0, 0) to the bottom-right… Read More
Given an array arr[] and an integer K, the task is to find a subarray of length K having sum which is a perfect square.… Read More
Given an array arr[] of size N and an array range[], the task is to check if the sum of the subarray {range[0], .. ,… Read More
Given an array arr[] of size N, the task is to find the count of subarrays of at least length 2, such that the difference… Read More
Given two positive integers N and K, the task is to find the Kth character of a string obtained by performing the following operation on… Read More
Given an integer N, the task is to check if any permutation of N without any leading zeros is a power of 2. If any… Read More
Given an integer N, the task is to find the total number of right angled triangles that can be formed such that the length of… Read More
Given two matrices mat1[][] and mat2[][] of size NxN. The task is to find if the given two matrices are mirror images of one another.… Read More