前言
我從mocha的這篇文章中獲得了不少關於CSES Two Stacks Sorting這題的想法,我希望這篇文能把他沒有說明清楚的部分,用我自己的方法來補充。
題敘
有一個長度為 $n$ 的permutation,你可以執行以下兩種操作的其中一種:
把輸入序列中尚未處理的第一個數字放入兩個stack的其中一個
把數字從某個stack中取出來並加到陣列 $b$ 的後方
請問有沒有可能使陣列 $b$ 為遞增序列?
Are you sure to leave this team?
Once you delete your team, all team notes will be deleted and cannot be recovered. Please ensure you've exported or transfered these notes.
Enter team name before deleting it:
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up