@@ -0,0 +1,882 @@
+public class Solution %7B%0A    public void nextPermutation(int%5B%5D nums) %7B%0A        ArrayList%3CInteger%3E left = new ArrayList%3C%3E();%0A        int i;%0A        for(i = nums.length - 1; i %3E= 0; i--)%7B%0A            if(left.size() == 0 %7C%7C left.get(left.size() - 1) %3C= nums%5Bi%5D)%7B%0A                left.add(nums%5Bi%5D);%0A                continue;%0A            %7Delse%7B%0A                left.add(nums%5Bi%5D);%0A                Collections.sort(left);%0A                for(int t: left)%7B%0A                    if(t %3E nums%5Bi%5D)%7B%0A                        nums%5Bi%5D = t;%0A                        break;%0A                    %7D%0A                %7D%0A                left.remove(new Integer(nums%5Bi++%5D));%0A                for(int t: left)%7B%0A                    nums%5Bi++%5D = t;%0A                %7D%0A                return;%0A            %7D%0A        %7D%0A        i = 0;%0A        for(int t: left)%7B%0A            nums%5Bi++%5D = t;%0A        %7D%0A        return;%0A    %7D%0A%7D

Q31 Next Permutation