Given an array of integers arr, sort the array by performing a series of pancake flips.
In a single pancake flip, choose an integer k such that arr.length, and reverse the prefix containing the first k elements of arr.
Return a list of values of k corresponding to a sequence of pancake flips that sorts arr. Any valid sequence of pancake flips that sorts the array is acceptable.
Constraints:
arr.length
arr[i] arr.length
All integers in arr are unique (that is, arr is a permutation of the integers from arr.length).
Given an array of integers arr, sort the array by performing a series of pancake flips.
In a single pancake flip, choose an integer k such that arr.length, and reverse the prefix containing the first k elements of arr.
Return a list of values of k corresponding to a sequence of pancake flips that sorts arr. Any valid sequence of pancake flips that sorts the array is acceptable.
Constraints:
arr.length
arr[i] arr.length
All integers in arr are unique (that is, arr is a permutation of the integers from arr.length).