You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我们想一下```LC31 next permutation```是怎么操作的。已知序列```12375421```,对于next permuation,我们想尽量保持高位的数字不变,将数字重新排列使其稍微增大一点点。但是我们发现后面五位75421已经是降序了,如果我们保持高3位不变、只变动低5位的话,无论如何不能使得序列变大。所以我们只能变动第3位,试图将其变高一点点,那么变成哪一个呢?显然就是将后5位里面挑一个比3大一点点的数字,那么就是4.当我们把第3位提升之后,剩下的5位自然要越小越好,那么就是将剩下没有使用的37521升序排列即可:12412357
0 commit comments