# Arrays Problems

**32**Pins

**1**Followers

Given an array of n elements which contains integers from 0 to n-1 only. The numbers can appear any number of times. Find the repeating numbers. Check out the solution in O(n) time and in O(1) extra space. Java visualization is provided in algorithm visualization section. Java code is given in the code snippet section.

#### Find duplicates in an integer array

The basic idea to solve this problem is to find out number of 1's on the both side of each 0. In this intuitive algorithm, what we do is that we build a count array which would keep track of number of 1's on both side of each 0.

#### O(n) time approach to find index of 0 to replace to get longest continuous sequence of 1s

Positive elements should be placed at even indices and negative elements should be placed at odd indices. The order of same signed elements should remain same. It is not guaranteed that positive and negative elements are equal in number.

#### Re-arrange elements in an array to put positive and negative elements in alternate order

For every element a[i] in array 'a', we need to find the largest element less than a[i](say leftLargest[i]) in left sub-array a[0 .. i-1]and largest element greater than a[i](say rightLargest[i]) in right sub-array a[i+1 .. lengthOfArray-1].

#### Find increasing sub-sequence of length three having maximum product | Optimized approach

Given an array of positive numbers, find sub-sequence of length three having maximum product. The elements of sub-sequence should be in increasing order. For example, for the input array {6, 7, 8, 1, 2, 3, 9, 10} output should be sub-sequence 8,9,10.