Write a function that will shift a matrix n times.
You will be given a rectangular matrix called m and must bring n characters at the end of the ...
For further actions, you may consider blocking this person and/or reporting abuse
I think the 2nd example is wrong...
And the solution in APL (Dyalog APL) is:
The left argument is the number of characters to shift and the right argument is the matrix. The approach (read from right to left) is as follows:
Test cases:
pretty esoteric but interesting! 🥴🥴🥴
Yes indeed, the second example is wrong, I just noticed that when doing the unit tests!
Haskell
Basically the algorithm is as follows:
simple. 👍🏿
i still feel like Haskell has too many non-alpha characters in the syntax set. 🙄
Haha, yeah, it's marginally easier once you get used to them though.
i'll take your word for it and stay in my (((safe (space)))) for now . . .
🤗
Rust:
The
match
allows for this test to pass:Javascript
In Python, using list splicing to shift the matrix and extract part of the flattened list to reconstruct the matrix.
quick python solution and headache for the rest of the day
Elm
Tests