(UVA) Knuth's Permutation - Solution
Link to the problem: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=646&page=show_problem&problem=1004 The solution below used Backtracking to solve this problem. import java.io.*; import java.util.*; class Main { public String sequence; BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out)); public void rec(int index, char[] array) throws NumberFormatException, IOException { if (index == sequence.length()) { for (int i = 0; i < array.length; i++) { bw.write(array[i]); } bw.write("\n"); ...