## Longest substring having K distinct vowels

Given a string s we have to find the length of the longest substring of s which contain exactly K distinct vowels. Note: Consider uppercase… Read More »

## Making elements of two arrays same with minimum increment/decrement

Given two arrays of same size, we need to convert the first array into another with minimum operations. In an operation, we can either increment… Read More »

## Maximum difference between groups of size two

Given an array of even number of elements, form groups of 2 using these array elements such that the difference between the group with highest… Read More »

Given an array and a value k. We have to find the maximum number of equal elements possible for the array so that we can… Read More »

## Minimum difference between groups of size two

Given an array of even number of elements, form groups of 2 using these array elements such that the difference between the group with the… Read More »

## Vantieghems Theorem for Primality Test

Vantieghems Theorem is a necessary and sufficient condition for a number to be prime. It states that for a natural number n to be prime,… Read More »

## Array with GCD of any of its subset belongs to the given array

Given a set of N elements such that N, task is to generate an array such that the GCD of any subset of the generated… Read More »

## Two Dimensional Segment Tree | Sub-Matrix Sum

Given a rectangular matrix M[0…n-1][0…m-1], and queries are asked to find the sum / minimum / maximum on some sub-rectangles M[a…b][e…f], as well as queries… Read More »

## Combinatorics on ordered trees

An ordered tree is an oriented tree in which the children of a node are somehow ordered. It is a rooted tree in which an… Read More »

## Sum of range in a series of first odd then even natural numbers

The sequence first consists of all the odd numbers starting from 1 to n and then remaining even numbers starting 2 up to n. Let’s… Read More »

## Dynamic Programming | Wildcard Pattern Matching | Linear Time and Constant Space

Given a text and a wildcard pattern, find if wildcard pattern is matched with text. The matching should cover the entire text (not partial text).… Read More »

## Multistage Graph (Shortest Path)

A Multistage graph is a directed graph in which the nodes can be divided into a set of stages such that all edges are from… Read More »

## Find the Largest Cube formed by Deleting minimum Digits from a number

Given a number n, the task is to find the largest perfect cube that can be formed by deleting minimum digits(possibly 0) from the number.… Read More »

## Pairs involved in Balanced Parentheses

Given a string of brackets, task is to find the number of pairs of brackets involved in a balanced sequence in a given range. Examples… Read More »

## Minimum digits to remove to make a number Perfect Square

Given a integer n, we need to find how many digits remove from the number to make it a perfect square. Examples : Input :… Read More »