Chef and Riffles
Let $f$ be a [permutation](https://en.wikipedia.org/wiki/Permutation) of length $N$, where $N$ is **even**. The *riffle* of $f$ is defined to be the permutation $$g = (f(1), f(3), \ldots, f(N-1), f(2), f(4), \ldots, f(N))$$ You are given two integers $N$ and $K$. Output the resultant permutation when you riffle the identity permutation of length $N$, $K$ times. The identity permutation of length
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.
Sign in to chat with the tutor and save your progress.
Sign in to start