next_permutation1 [JAVA] next_permutation, prev_permutation static boolean nextPermutation(int[] arr){ int i = arr.length-1; while(i>0 && arr[i-1]>=arr[i]) --i; if(i==0) return false; int j = arr.length - 1; while(arr[i-1]>=arr[j]) --j; int temp = arr[i-1]; arr[i-1] = arr[j]; arr[j] = temp; int k = arr.length-1; while(i 0 && arr[i - 1] 2020. 9. 19. 이전 1 다음