| 21 | |
| 22 | |
| 23 | class Solution { |
| 24 | public: |
| 25 | string getPermutation(int n, int k) { |
| 26 | vector<int > v; |
| 27 | |
| 28 | fact[0]=1,fact[1]=1,fact[2]=2;// pre compute factorial |
| 29 | for(int i=3;i<=n;i++){ |
| 30 | fact[i]=fact[i-1]*i; |
| 31 | } |
| 32 | c=0; |
| 33 | s=""; |
| 34 | for(int i=1;i<=n;i++){ // insert the first permutation in sorted order |
| 35 | v.push_back(i); |
| 36 | } |
| 37 | calc(n,k,n-1,v); |
| 38 | |
| 39 | return s; |
| 40 | |
| 41 | } |
| 42 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected