## Find if there is a rectangle in binary matrix with corners as 1

There is a given binary matrix, we need to find if there exists any rectangle or square in the given matrix whose all four corners… Read More »

## Non-overlapping sum of two sets

Given two arrays A[] and B[] of size n. It is given that both array individually contains distinct elements. We need to find the sum… Read More »

## Distributing items when a person cannot take more than two items of same type

Given N sweets which can be of many different types and k customers, one customer won’t take the same type of sweet more than 2… Read More »

## Maximum Unique Element in every subarray of size K

Given an array and an integer K. We need to find the maximum of every segment of length K which has no duplicates in that… Read More »

## Largest increasing subsequence of consecutive integers

Given an array of n positive integers. We need to find the largest increasing sequence of consecutive positive integers. Examples: Input : arr[] = {5,… Read More »

## Root to leaf path with maximum distinct nodes

Given a Binary Tree, find count of distinct nodes in a root to leaf path with maximum distinct nodes. Examples: Input : 1 / \… Read More »

## Only integer with positive value in positive negative value in array

Given an array of N integers. In the given, for each positive element ‘x’ there exist a negative value ‘-x’, except one integer whose negative… Read More »

## Longest subarray not having more than K distinct elements

Given N elements and a number K, find the longest subarray which has not more than K distinct elements.(It can have less than K) Examples:… Read More »

## Elements to be added so that all elements of a range are present in array

Given an array of size N. Let A and B be the minimum and maximum in the array respectively. Task is to find how many… Read More »

## Smallest subarray with k distinct numbers

We are given an array a consisting of n integers and an integer k. We need to find the minimum range in array [l, r]… Read More »

## Program to sort string in descending order

Given a string, sort it in descending order. Examples: Input : alkasingh Output : snlkihgaa Input : nupursingh Output : uusrpnnihg Input : geeksforgeeks Output… Read More »

## Longest subsequence such that difference between adjacents is one | Set 2

Given an array of size n. The task is to find the longest subsequence such that difference between adjacents is one. Time Complexity of O(n)… Read More »

## Number of NGEs to the right

Given an array of n integers and q queries, print the number of next greater elements to the right of the given index element. Examples:… Read More »

## Longest subarray having count of 1s one more than count of 0s

Given an array of size n containing 0’s and 1’s only. The problem is to find the length of the longest subarray having count of… Read More »

## Maximum number of characters between any two same character in a string

Given a string, find the maximum number of characters between any two same character in the string. If no character repeats, print -1. Examples: Input… Read More »