Skip to main content
57 votes

N-dimensional N^N array filled with N

Python, 32 bytes lambda n:eval('['*n+'n'+']*n'*n) Try it online! Makes a string like "[[[n]*n]*n]*n" with ...
xnor's user avatar
  • 145k
34 votes

N-dimensional N^N array filled with N

J, 4 bytes $~#~ Try it online! Explanation ...
miles's user avatar
  • 16.9k
21 votes
Accepted

No strings (or numbers) attached

Hexagony, 13 bytes 1 2 3 4 5 6 7 8 9 10 42 Try it online! In Hexagony, 0 through 9 are functions that multiply the current ...
Leaky Nun's user avatar
  • 49.8k
16 votes

N-dimensional identity "matrix"

Octave, 29 bytes @(n)accumarray((x=1:n)'+!x,1) Try it online!
rahnema1's user avatar
  • 5,665
16 votes

Help Stack Exchange transpose tables

Python 3.8 (pre-release), 218 bytes ...
Anakhand's user avatar
  • 301
15 votes

All the k-mers/n-grams

Jelly, 1 byte Jelly has a single byte dyadic atom for this very operation Try it online! (the footer splits the resulting list with newlines, to avoid a ...
Jonathan Allan's user avatar
13 votes

N-dimensional N^N array filled with N

APL (Dyalog APL), 4 bytes ⍴⍨⍴⊢ Try it online!
Dennis's user avatar
  • 210k
13 votes

N-dimensional N^N array filled with N

Mathematica, 22 20 bytes (t=Table)@@t[#,#+1]& (* or *) Table@@Table[#,#+1]&
JungHwan Min's user avatar
  • 13.8k
10 votes

N-dimensional N^N array filled with N

JavaScript (ES6),  44  40 bytes f=(n,k=i=n)=>i--?f(n,Array(n).fill(k)):k Demo ...
Arnauld's user avatar
  • 193k
10 votes

N-dimensional N^N array filled with N

Octave, 35 33 25 23 20 bytes @(N)ones(N+!(1:N))*N Try it online! @(N)ones(N*ones(1,N))*N @(N)repmat(N,N*ones(1,N)) Thanks to @...
rahnema1's user avatar
  • 5,665
10 votes

N-dimensional N^N array filled with N

R, 26 This is the obvious answer but perhaps there is something cleverer? n=scan();array(n,rep(n,n))
Flounderer's user avatar
10 votes

Typo resistant pin codes

Python 2, 1000 unique pin codes, 44 bytes i=0;exec'print i+int(`i`,11)%10;i+=10;'*1000 Try it online! I suspect 1000 pin codes is optimal. You can check the ...
Sisyphus's user avatar
  • 14.8k
9 votes

N-dimensional N^N array filled with N

05AB1E (legacy), 6 5 bytes -1 thanks to Kevin Cruijssen F¹.D) Try it online! ...
Riley's user avatar
  • 11.7k
9 votes

N-dimensional N^N array filled with N

Haskell, 52 bytes f n=iterate(filter(>'"').show.(<$[1..n]))(show n)!!n Try it online! Inspired by @nimi's answer, but using more predefined functions. ...
Ørjan Johansen's user avatar
9 votes

Borderless table

JavaScript (ES8),  186 180  179 bytes Saved 1 byte thanks to @Shaggy ...
Arnauld's user avatar
  • 193k
9 votes

Help Stack Exchange transpose tables

K (ngn/k), 84 73 67 59 bytes -6 bytes from @rak1507's trim implementation (2(|(&\^:)_)/) -19 bytes from golfing ...
coltim's user avatar
  • 5,903
8 votes

Generate a 6 character string from a 15 character alphabet

CJam (23 + 14 + 10 = 47 bytes) Arbitrary alphabet: 23 bytes (online demo) {"ABC123!@TPOI098"mR}6* Hexadecimal alphabet: 14 bytes (online demo) ...
Peter Taylor's user avatar
  • 43.1k
8 votes

N-dimensional N^N array filled with N

Haskell, 62 bytes n#0=show n n#l='[':tail((',':)=<<n#(l-1)<$[1..n])++"]" f n=n#n Usage example: f 2 -> ...
nimi's user avatar
  • 35.9k
8 votes

All the k-mers/n-grams

Octave, 28 bytes @(N,s)s((1:N)+(0:nnz(s)-N)') Try it online! For k > string length works in Octave 4.2.1-windows but in tio (Octave 4.0.3) doesn't work. Creates ...
rahnema1's user avatar
  • 5,665
8 votes

Generate Gmail Dot-Aliases

Python 3, 72 69 bytes -3 bytes thanks to Jitse! Input includes @gmail.com. ...
ovs's user avatar
  • 59.5k
7 votes

N-dimensional N^N array filled with N

Python 2, 36 bytes -2 bytes thanks to @CalculatorFeline a=n=input() exec"a=[a]*n;"*n print a Try it online!
Trelzevir's user avatar
  • 1,007
7 votes

N-dimensional N^N array filled with N

MATL, 8 bytes ttY"l$l* Try it at MATL Online (I have added some code showing the actual size of the output since all n-dimensional outputs in MATL are shown ...
Suever's user avatar
  • 11.1k
7 votes

N-dimensional N^N array filled with N

Jelly, 5 bytes ⁾Wẋẋv Try it online! How? ...
Jonathan Allan's user avatar
7 votes

N-dimensional N^N array filled with N

Jelly, 4 bytes R»µ¡ Try it online! ...
dylnan's user avatar
  • 5,364
7 votes

Simple CSV/DSV importer

Powershell, 25 22/23 bytes Two Options, one just calls split on the first arg, using the second arg as a delim value. $args[0]-split$args[1] One byte longer, ...
colsw's user avatar
  • 3,367
7 votes

Simple CSV/DSV importer

Japt, 3 bytes mqV Test it online! (Uses the -Q flag to prettyprint the output) ...
ETHproductions's user avatar
7 votes

All the k-mers/n-grams

C (GCC on POSIX), 67 66 63 bytes -3 bytes thanks to @LeakyNun! f(i,s,j)char*s;{for(;j+i<=strlen(s);puts(""))write(1,s+j++,i);} Try it online!
betseg's user avatar
  • 8,723
7 votes

All the k-mers/n-grams

05AB1E, 2 bytes Code: Ν Explanation: ...
Adnan's user avatar
  • 44.4k

Only top scored, non community-wiki answers of a minimum length are eligible