A more efficient solution. Comment Instead of going 1, 2, 3, 4, 4, 3, 2, 1. It would be simpler and faster to go 2, 3, 3, 2. Reply
Instead of going 1, 2, 3, 4, 4, 3, 2, 1.
It would be simpler and faster to go 2, 3, 3, 2.