first solution to Permutation Sequence.java