- a single duplicate number exists
- multiple duplicate numbers exist
Showing posts with label CLRS. Show all posts
Showing posts with label CLRS. Show all posts
Find duplicates in an array
Given an array of size 'n', containing elements from 1 to 'n', find out if there are any duplicates in the array. Solve this, if
Find subarray with maximum sum
Given an array of size n, containing positive and negative integers, find the longest sub-array such that the sum of the elements in the sub-array is the maximum.
For example,
Given array :
10, 8, -5, 1, -27, 5, 7, -5, 11
the sub array should be : 10, 8
Source : CLRS & this sample interview question
For example,
Given array :
10, 8, -5, 1, -27, 5, 7, -5, 11
the sub array should be : 10, 8
Source : CLRS & this sample interview question
Subscribe to:
Posts (Atom)