Vyxal, 14(削除) 14 (削除ここまで) 12 bytes
f=ṖL√vẇ'ÞDṖ'L√ẇÞDf?=;h
Math? Sensible methods of putting things into arrays? Programs that finish in reasonable time? Couldn't be me.
Times out for anything bigger than a 2x2 matrix.
Takes input as a flattened list and outputs a flattened list.
Explained (old)
f=ṖL√vẇ'ÞD?=;h
f=ṖL√ # Push all permutations of the flattened input, as well as the square root of the length of the flattened input
vẇ # Split each permutation into chunks of that length
'ÞD?=; # Keep those only where the diagonals equal the input (this basically means try each and every single possible matrix from the input until one is found with the same diagonals)
h # Get the first (and only) item
Vyxal, 14 bytes
f=ṖL√vẇ'ÞD?=;h
Math? Sensible methods of putting things into arrays? Programs that finish in reasonable time? Couldn't be me.
Times out for anything bigger than a 2x2 matrix.
Explained
f=ṖL√vẇ'ÞD?=;h
f=ṖL√ # Push all permutations of the flattened input, as well as the square root of the length of the flattened input
vẇ # Split each permutation into chunks of that length
'ÞD?=; # Keep those only where the diagonals equal the input (this basically means try each and every single possible matrix from the input until one is found with the same diagonals)
h # Get the first (and only) item
Vyxal, (削除) 14 (削除ここまで) 12 bytes
Ṗ'L√ẇÞDf?=;h
Math? Sensible methods of putting things into arrays? Programs that finish in reasonable time? Couldn't be me.
Times out for anything bigger than a 2x2 matrix.
Takes input as a flattened list and outputs a flattened list.
Explained (old)
f=ṖL√vẇ'ÞD?=;h
f=ṖL√ # Push all permutations of the flattened input, as well as the square root of the length of the flattened input
vẇ # Split each permutation into chunks of that length
'ÞD?=; # Keep those only where the diagonals equal the input (this basically means try each and every single possible matrix from the input until one is found with the same diagonals)
h # Get the first (and only) item
Vyxal, 14 bytes
f=ṖL√vẇ'ÞD?=;h
Math? Sensible methods of putting things into arrays? Programs that finish in reasonable time? Couldn't be me.
Times out for anything bigger than a 2x2 matrix.
Explained
f=ṖL√vẇ'ÞD?=;h
f=ṖL√ # Push all permutations of the flattened input, as well as the square root of the length of the flattened input
vẇ # Split each permutation into chunks of that length
'ÞD?=; # Keep those only where the diagonals equal the input (this basically means try each and every single possible matrix from the input until one is found with the same diagonals)
h # Get the first (and only) item