Zig-zag matrix: Difference between revisions
no edit summary
m (→{{header|J}}: restate "edge cases" comment for clarity.) |
No edit summary |
||
Line 3,354:
End</pre>
=={{header|K}}==
ngn/k dialect:
<syntaxhighlight>
f:{grid:+x#<<a,'(<a)*- 2!a:+/!x,:x
padded:(-#$-1+*/x)$$grid
`0:" "/'padded}
f 5
</syntaxhighlight>
{{out}}
<pre>
0 1 5 6 14
2 4 7 13 15
3 8 12 16 21
9 11 17 20 22
10 18 19 23 24
</pre>
=={{header|Kotlin}}==
|