← All problemsSign in

Hamming equivalent

CodeChefRating 1298Open on judge ↗

You are given a permutation $P$ of length $N$. You are allowed to perform the following operation any number of times: - Choose any two numbers $P_i$ and $P_j$ such that the number of set bits ($1$s in their binary representation) is the same, and swap them. Determine if it is possible to sort the permutation in ascending order using this operation. If possible, print Yes; otherwise, print No. #

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