← All problemsSign in

Permutation Split

Flippy the bird has a permutation p of length n while Fluffy the squirrel has a permutation q of length n. Flippy the bird wants his permutation to be the same as Fluffy's permutation. He can cut the permutation into several parts, and rearrange those parts so that the resulting permutation is equal to q. He wants to cut the permutation into the minimum possible number of pieces. Can you help him

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