Toptal Interview Question

Interviewer requested me to explain the solution I provided in the technical test - 60 seconds