I was asked this question in recent De Shaw interview for entry level software developer.

You are given k number of groups having unequal ranges :-

g1 - 0 - 10

g2 - 11 -15

g3 - 16-22

g4 - 23-34

and a sequence of numbers. You have to find the length of minimum window containing element from every group. I had to do this **without using map**.

for eg. 9, 5, 3, 12, 17, 25, 27

Ans - 4

Another Question that was asked :

You are given a binary tree. You have to find an AP series in tree such that no two nodes are consecutive and distance between 2 node (i.e. no. of nodes between the 2 nodes) should be from 1-3 (there can be one node, two node or three node) between consecutive terms of AP series. I had to find the length of longest AP series.

- You cannot revisit the node once you traverse the node. For eg 1 -> 2-> 5 -> 4 -> 3. 1, 3, 5 is not a valid sequence for the above binary tree.

I was not able to solve the question.