← All problemsSign in

Bitty Permutations

One day the chef went to a magic cave where he got a magical number $M$ , then he was given an array $A$ with $M$ elements and his task is to find two permutations $P1$ and $P2$ such that it contains integers from $0$ to $M-1$. Condition of valid permutations is for every $i$ (1<=$i$<=M), $A[i]$ should be equal to $P1[i]⊕P2[i]$ ,Where $⊕$ denotes bitwise XOR. All elements of $A[i]$ are in suc

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