Thoughtworks Interview Question

Few data structures problem