天天看點

Permutation Sequence

The set <code>[1,2,3,…,n]</code> contains a total of n! unique permutations.

By listing and labeling all of the permutations in order,

We get the following sequence (ie, for n = 3):

<code>"123"</code>

<code>"132"</code>

<code>"213"</code>

<code>"231"</code>

<code>"312"</code>

<code>"321"</code>

Given n and k, return the kth permutation sequence.

Note: Given n will be between 1 and 9 inclusive.

參考:http://www.cnblogs.com/tenosdoit/p/3721918.html

C++實作代碼:

繼續閱讀