[permutation] write code for permutation sequence