Hive.ai·Software Engineer·Technical Phone Screen
- Given an array of integers, sort it using only pancake flips. A pancake flip reverses the subarray from index 0 to k-1. Return the sequence of k values used. Any solution within 10 * n flips is acceptable.
“I knew the general idea pretty quickly: find the max in the unsorted portion, flip it to the front, then flip it into its correct position at the end.”