PlaidOA #2
Min Shuffle Moves to Sort Deck
估计简单评测数据准备中,可先阅读题面
考点(AI 标注)原地数组
You have a deck of cards numbered from 1 to n. The cards are currently in some order; you want to sort them ascending. The only operation: take k cards from the top of the deck and move them to the bottom (k ∈ [0, n-1]). Return the minimum number of cards k to move, or -1 if impossible.
deck = [1, 4, 2, 3]→-1deck = [3, 4, 5, 1, 2]→3