From b7f174dc2ddaa9d1e2c198fd3b3ad32afd6fd940 Mon Sep 17 00:00:00 2001 From: user Date: Wed, 29 Jul 2026 20:32:32 +0400 Subject: [PATCH] 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. --- 3518/solution.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3518/solution.cpp b/3518/solution.cpp index 3a48c63..efb16eb 100644 --- a/3518/solution.cpp +++ b/3518/solution.cpp @@ -34,7 +34,7 @@ public: } auto it = permutations.begin(); - advance(it, k); + advance(it, k - 1); string mirroredHalf = *it; reverse(mirroredHalf);