The survey of permutations of finite sets is an important subject in the fields of combinatorics and group theory. In elementary combinatorics, the K-permutations, or partial permutations, are the ordered agreements of K distinct components choose from a set. Stedman widens the consideration of permutations; he goes on to consider the number of permutations of the letters of the alphabet and of horses from a stable of 20.A first case in which apparently unrelated mathematical questions were study with the help of permutations happened around 1770, when Joseph Louis Lagrange, in the survey of polynomial equations, detected that property of the permutations of the beginnings of an equation are associated to the possibility to solve it. Fabian Stedman in 1677 described factorials when explaining the number of permutations of Bell in change ringing. The rule to determine the number of permutations of n objects was known in Indian culture around 1150.

COMING SOON!

```
const int factorial[10] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880};
class Solution {
public:
string getPermutation(int n, int k) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
//
// http://zh.wikipedia.org/wiki/%E5%BA%B7%E6%89%98%E5%B1%95%E5%BC%80
//
string sequence;
bool hash[12];
memset(hash, false, sizeof(hash));
k -= 1;
for (int i = n; i >= 1; i--) {
int x = k / factorial[i-1];
int count = 0;
for (int j = 1; j <= n; j++) {
if (!hash[j]) count += 1;
if (count == x + 1) {
x = j;
break;
}
}
k %= factorial[i-1];
hash[x] = true;
sequence += x + '0';
}
return sequence;
}
};
```