Google Interview Question

DSA questions on loops was difficult to solve