Divide a list of numbers into groups of consecutive numbers but their original order should be preserved.
Example:
<8,2,4,7,1,0,3,6>
should be divided into two groups like this:
<2,4,1,0,3> <8,7,6>
Source : http://discuss.techinterview.org/default.asp?interview.11.770712.8
Sort on second key when, first key in a set is sorted
Assume that we are given as input n pairs of items, where
For example: (1,blue), (3,red), (4,blue), (6,yellow), (9,red) should become (3,red), (9,red), (1,blue), (4,blue), (6,yellow).
- the first item is a number
- the second item is one of three colors (red, blue, or yellow).
For example: (1,blue), (3,red), (4,blue), (6,yellow), (9,red) should become (3,red), (9,red), (1,blue), (4,blue), (6,yellow).
Find if summation of numbers from two lists is given number
Problem: Given two lists A & B define an algo, which will identify two numbers 'a' and 'b', such that a + b = x, where 'x' is the input.
Subscribe to:
Posts (Atom)




