Solved LeetCode program · 898 of 1,000
#1238 · Circular Permutation in Binary Representation
Original English source
The width is 2. The start is 3. The amount is 1.
For every step from 1 to width.
Set amount to amount times 2.
The line is empty text. Place "[" into line.
For every spot from 0 to amount minus 1.
The shifted is shift spot right by 1. The mixed is exclusive or of spot and shifted. The value is exclusive or of mixed and start. If spot is more than 0, Place "," into line. The piece is format whole number value as text. Place piece into line.
Place "]" into line. Show line.
Expected stdout
[3,2,0,1]