PhysicsWallah interview question

LeetCode Advanced Loop Array question