← All problemsSign in

Sort String

CodeChefRating 2815Open on judge ↗

Chef has a string $S$ with length $N$ and integer $K$. Let's consider all strings that can be obtained by erasing $K$ consecutive characters from the original string ― specifically, for each $i$ ($1 \le i \le N-K+1$), let $f(i)$ be the string that is obtained by erasing the characters at positions $i, i+1, \ldots, i + K - 1$. Consider a permutation $P$ of the integers $1$ through $N - K + 1$. Y

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start