Greedy approach to Interview problems