One of the loops is starting at the end of the array and the other at the beginning. It is almost like a bat hitting a ball. The ball starts at one end and moves toward the bat. The bat hits it and it goes back to the beginning. The only difference in this situation is that after the bat hits the ball it moves closer to the balls starting position by 1 index. I hope that helps