Skip to main content
added 469 characters in body
Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Wolfram Language (Mathematica), 45 bytes

Mod[#-{0,##&@@Most@#}&/@Range@#~Tuples~#2,#]&

Try it online!

A port of @ovs's BQN answer.


Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!

Finds a Hamiltonian path of the \$\underbrace{N\times\cdots\times N}_{k}\$ grid graph.

Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!

Finds a Hamiltonian path of the \$\underbrace{N\times\cdots\times N}_{k}\$ grid graph.

Wolfram Language (Mathematica), 45 bytes

Mod[#-{0,##&@@Most@#}&/@Range@#~Tuples~#2,#]&

Try it online!

A port of @ovs's BQN answer.


Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!

Finds a Hamiltonian path of the \$\underbrace{N\times\cdots\times N}_{k}\$ grid graph.

added 90 characters in body
Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!

Finds a Hamiltonian path of the \$\underbrace{N\times\cdots\times N}_{k}\$ grid graph.

Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!

Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!

Finds a Hamiltonian path of the \$\underbrace{N\times\cdots\times N}_{k}\$ grid graph.

Source Link
alephalpha
  • 50k
  • 7
  • 68
  • 182

Wolfram Language (Mathematica), 59 bytes

IntegerDigits[FindHamiltonianPath@GridGraph@Table@##-1,##]&

Try it online!