How to solve this problem?
This question was asked in hackwithinfy, I could not approach this problem anyhow, can anyone tell me the optimal approach to solve these type of problems and the solution of this specific problem. Here is the question : part1 part2