Approach hintTry it first, then revealHide
Solve both halves recursively and return each half's minimum and maximum. If the left half holds the larger values, count one swap; if the two halves do not form consecutive ranges, the answer is -1.
Solve both halves recursively and return each half's minimum and maximum. If the left half holds the larger values, count one swap; if the two halves do not form consecutive ranges, the answer is -1.