# Category: Array

## Length of longest continuous sequence with same sum in given binary arrays

Given two Boolean arrays X and Y, find the length of longest continuous sequence that starts and ends at same index in both arrays and have same sum. In other words, find max(j-i+1) for every j >= i where sum of sub-array X[i, j] is equal to sum of sub-array Y[i, j].

Read More Length of longest continuous sequence with same sum in given binary arrays

## Quicksort using Dutch National Flag Algorithm

Implement Quicksort efficiently for inputs containing many repeated elements.     Quicksort exhibits poor performance for inputs that contain many repeated elements. The problem is clearly visible when all the input elements are equal. Then at each recursion, the left partition is empty (no input values are less than the pivot), and the right partition …

Read More Quicksort using Dutch National Flag Algorithm

## Ternary Search vs Binary search

In this article, we will implement Ternary Search algorithm and compare its performance with Binary Search.

Read More Ternary Search vs Binary search

## All combinations of elements satisfying given constraints

Given a positive number N, find all combinations of 2*N elements such that every element from 1 to N appears exactly twice and distance between its two appearances is exactly equal to value of the element.

Read More All combinations of elements satisfying given constraints

## Longest Increasing Subsequence

The longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence’s elements are in sorted order, lowest to highest, and in which the subsequence is as long as possible. This subsequence is not necessarily contiguous, or unique.

## Maximum profit earned by buying and selling shares any number of times

Given a list containing future prediction of share prices, find maximum profit that can be earned by buying and selling shares any number of times with constraint that a new transaction can only start after previous transaction is complete. i.e. we can only hold at-most one share at a time.

Read More Maximum profit earned by buying and selling shares any number of times

## Merging Overlapping Intervals

Given a set of intervals, print all non-overlapping intervals after merging overlapping intervals.