fix: correct permutation iterator offset for k index

Adjust iterator advancement to account for 1-based k indexing.
This fixes returning the wrong permutation when selecting the k-th
result.
This commit is contained in:
user
2026-07-29 20:32:32 +04:00
parent eedf8d826a
commit b7f174dc2d
+1 -1
View File
@@ -34,7 +34,7 @@ public:
} }
auto it = permutations.begin(); auto it = permutations.begin();
advance(it, k); advance(it, k - 1);
string mirroredHalf = *it; string mirroredHalf = *it;
reverse(mirroredHalf); reverse(mirroredHalf);