Pinterest • The world’s catalogue of ideas

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

ideserve.co.in

Number of clusters of 1s OR Number of Islands - IDeserve

#### Number of clusters of 1s OR Number of Islands

ideserve.co.in

Find maximum element from each sub-array of size 'k'| Set 1

#### IDeserve - Unique learning platform to enhance algorithmic skills.

ideserve.co.in

Find maximum element from each sub-array of size 'k'| Set 2 - IDeserve

#### Find maximum element from each sub-array of size 'k'| Set 2

ideserve.co.in

Remove spaces from a given string - IDeserve

#### Remove spaces from a given string

ideserve.co.in

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

ideserve.co.in

Find index of 0 to replace to get longest continuous sequence of 1s - IDeserve

#### Find index of 0 to replace to get longest continuous sequence of 1s

ideserve.co.in

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

ideserve.co.in

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

ideserve.co.in

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.

ideserve.co.in