Problem 969 · Medium

Pancake Sorting

Sort using prefix reversals: bring the largest unsorted value to the front, then flip it into place.

Open the interactive visualisation