30
2
I once had a beautiful rectangular array. It was very symmetrical, but unfortunately it has fallen apart and now I only have the top left corner. Your task will be to rebuild the original array.
Your program will receive a 2 dimensional array of integers. For ease of parsing, you may assume they are all between 1 and 9. Your task is to reverse the array's columns, its rows, and both, stitch together the resulting corners, and return the resulting array.
You can assume the array dimensions will be at least 1x1.
Test cases:
Input:
1 2 3
4 5 6
Output:
1 2 3 3 2 1
4 5 6 6 5 4
4 5 6 6 5 4
1 2 3 3 2 1
Input:
1
Output:
1 1
1 1
Input:
9
9
9
Output:
9 9
9 9
9 9
9 9
9 9
9 9
This is code-golf, fewest bytes wins!
1I'll bet charcoal can do this in under 10 – FantaC – 2018-03-05T16:19:00.723
1
@tbfninja https://chat.stackexchange.com/transcript/message/43184083#43184083 but could maybe be shorter with a different input format.
– Pavel – 2018-03-05T16:20:21.730@MagicOctopusUrn yes – Pavel – 2018-03-05T16:39:51.413
2@tfbninja
WS⟦ι⟧‖M→↓
perhaps? 5 bytes to read the input and 4 to reflect it. – Neil – 2018-03-05T17:51:55.563@Neil nice <filler> – FantaC – 2018-03-05T17:55:35.170
@Neil yeah, except that I don't see an answer yet :P also is that valid? – Erik the Outgolfer – 2018-03-05T18:34:25.697
4I'm 99% sure that there is a lang that do this with
╬
(or some similar character) just can't remember which one :c – Rod – 2018-03-05T19:36:56.913@Rod Close enough?
– totallyhuman – 2018-03-05T20:20:50.897@Rod called it :P. – Magic Octopus Urn – 2018-03-05T21:32:06.240