Thoughtworks Interview Question

2 porblems Long coding