Solved Permutation Sequence problem