1238. Circular Permutation in Binary Representation
Given 2 integers n and start. Your task is return any permutation p of (0,1,2.....,2^n -1) such that : - p[0] = start - p[i] and p[i+1] differ by only one bit in their binary representation. - p[0] and p[2^n -1] must also differ by only one bit in their binary representation. Example 1: Input: n = 2, start = 3 Output: [3,2,0,1] Explanation: The binary representation of the permutation
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