- Print 1000 random numbers of single digit each. Number should be between 0 to 9.
- Store the above elements in a array and move all the 0s into one end without changing the order of non-zero elements.
- Find out the top 50 elements in a stream of 1000 elements. Assume that numbers are streaming and you don't know the size ahead. and if you want to know the frequency of the top 50 elements also, how would you do? Hint: Heap
- Assume that you can only send 160 characters in one message. If you have a paragraph to send, how do you determine that and send it over network, every page should send which part the message it is, like [1/2]. Hint: Travese entire message first to determine whether there are multiple messages possible.
Round 2:
- Given array of integers, find out the first non-repeating element.
- Given M*N matrix of Integers, find out the area covered between 2 cells.
- Convert a doubly linked list into binary tree.
Round 3:
- Diff between SOAP and REST APIs.
- Given a src and dest vertex in a graph, write a method to return true if dest can reachable all possible paths from the src vertex. There can any number of intermediate vertices.
- [Puzzle] 4 persons of diff speeds need to cross a bridge with one torch where only two can travel at a time from the bridge, what is the minimum time that they take to reach all on the other side. How can you solve this generically.