Thoughtworks Interview Question

Round 1: Discussion on the solution submitted. Extension of the problem and solution for that.