Comments on Create a range grid
Parent
Create a range grid
This challenge is based on the i.
verb from J.
A range grid is basically a range of m × n
numbers fit into a rectangular grid with m
rows and n
columns.
A 2×3
range grid would be:
0 1 2
3 4 5
Challenge
Generate a range grid, given m
and n
. You can display it, or return an array.
This is code-golf
. Shortest answer in each language wins.
Ruby, 33 bytes ``` ->n,m{[(0 …
2y ago
BQN (CBQN), 10 bytes Anonymou …
2y ago
C (gcc), 59 bytes ``` C i; …
2y ago
[Python 2], 46 bytes …
2y ago
[Python 3], 49 bytes …
2y ago
Japt `-m`, 4 bytes VÆT° …
2y ago
MATL, 8 bytes ``` tp:qwPe! …
2y ago
Lua 5.4, 76 bytes ``` lua …
2y ago
Post
BQN (CBQN), 10 bytes
Anonymous function that takes m
on the left and n
on the right.
{𝕨‿𝕩⥊↕𝕨×𝕩}
↕𝕨×𝕩 # list of range [0,m*n)
𝕨‿𝕩⥊ # reshape list to m*n
1 comment thread