We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f59880f commit 4cae32aCopy full SHA for 4cae32a
src/permutationSequence/permutationSequence.cpp
@@ -69,6 +69,8 @@ string getPermutation(int n, int k) {
69
ss << num[idx];
70
num.erase(num.begin()+idx);
71
n--;
72
+ //the next k also can be caculated like this:
73
+ // k = (k-1)%group + 1;
74
k -= group * idx;
75
}
76
0 commit comments