## Find intersection point of two Linked Lists without finding the length

There are two singly linked lists in a system. By some programming error, the end node of one of the linked lists got linked to… Read More »

## Arrange numbers to form a valid sequence

Given an array arr[] with N distinct numbers and another array arr1[] with N-1 operators (either < or >), the task is to organize the… Read More »

## Find the resultant String after replacing X with Y and removing Z

Given a string str, the task is to replace all occurrences of the given X with given Y and also remove any occurrances of the… Read More »

## Remove minimum elements from ends of array so that sum decreases by at least K | O(N)

Given an array arr[] consisting of N elements, the task is to remove minimum number of elements from the ends of the array such that… Read More »

## Smallest non-zero substring which has any permutation divisible by 2^K

Given a binary string S of length N and an integer K, the task is to find the smallest non-zero sub-string of S that can… Read More »

## Find whether X exists in Y after jumbling X

Given two strings X and Y containing lower-case alphabets, the task is to check whether any permutation of string X exists in Y as its… Read More »

## Number of non-decreasing sub-arrays of length less than or equal to K

Given an array arr[] of N elements and an integer K, the task is to find the number of non-decreasing sub-arrays of length less than… Read More »

## Number of non-decreasing sub-arrays of length greater than or equal to K

Given an array arr[] of N elements and an integer K, the task is to find the number of non-decreasing sub-arrays of length greater than… Read More »

## Number of non-decreasing sub-arrays of length K

Given an array arr[] of length N, the task is to find the number of non-decreasing sub-arrays of length K. Examples: Input: arr[] = {1,… Read More »

## Find a triplet in an array whose sum is closest to a given number

Given an array arr[] of N integers and an integer X, the task is to find three integers in arr[] such that the sum is… Read More »

## Number of pairs with a given sum in a Binary Search Tree

Given a Binary Search Tree, and a number X. The task is to find the number of distinct pairs of distinct nodes in BST with… Read More »

## Smallest subarray containing minimum and maximum values

Given an array A of size N. The task is to find the length of smallest subarray which contains both maximum and minimum values. Examples:… Read More »

## Check if a triplet with given sum exists in BST

Given a Binary Search Tree and a SUM. The task is to check if there exists any triplet(group of 3 elements) in the given BST… Read More »

## Count triplets in a sorted doubly linked list whose product is equal to a given value x

Given a sorted doubly linked list of distinct nodes(no two nodes have the same data) and a value x. The task is to count the… Read More »

## Count pairs in a sorted array whose product is less than k

Given a sorted integer array and number k, the task is to count pairs in an array whose product is less than x. Examples: Input:… Read More »