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

# Category Archives: Searching

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 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