Practice Circular Permutation in Binary Representation
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#1238
LeetCode ProblemCircular Permutation in Binary Representation
Problem Statement
Return any permutation p of all integers from 0 through 2^n - 1 that begins with start. Each consecutive pair must differ in exactly one bit, and the last and first values must also differ in exactly one bit.
Source: Circular Permutation in Binary Representation on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 2, start = 3
Output
[3,2,0,1]
# Example 2
Input
n = 3, start = 2
Output
[2,6,7,5,4,0,1,3]
Constraints
1 <= n <= 16
0 <= start < 2 ^ n
Related LeetCode Problems
Practice more problems similar to Circular Permutation in Binary Representation.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.