#3537
Fill a Special Grid
pupil · 560 · lc medium +28 · 70.7% accepted · 111 likes · top 80%
Description
Fill a 2n x 2n grid with distinct integers 0 through 2^(2n) - 1 so that it is "special":
- Values in the top-right quadrant are all less than those in the bottom-right.
- Values in the bottom-right are all less than those in the bottom-left.
- Values in the bottom-left are all less than those in the top-left.
- Each quadrant is itself special.
A 1x1 grid is always special. Return the filled grid.
Code
1
2
3