6 kyu
Matrix Rotation
287 of 485cyril-lemaire
Description:
Given a matrix represented as a list of string, such as
###.....
..###...
....###.
.....###
.....###
....###.
..###...
###.....
write a function
rotate_clockwise(matrix)
that return its 90° clockwise rotation, for our example:
#......#
#......#
##....##
.#....#.
.##..##.
..####..
..####..
...##...
/!\ You must return a rotated copy of
matrix
! (matrix
must be the same before and after calling your function)
Note that the matrix isn't necessarily a square, though it's always a rectangle!
Please also note that the equalitym == rotateClockwise(rotateClockwise(rotateClockwise(rotateClockwise(m))));
(360° clockwise rotation), is not always true becauserotateClockwise([''])
=>[]
androtateClockwise(['','',''])
=>[]
(empty lines information is lost)
Matrix
Fundamentals
Similar Kata:
Stats:
Created | Jun 12, 2017 |
Published | Jun 12, 2017 |
Warriors Trained | 1188 |
Total Skips | 48 |
Total Code Submissions | 1973 |
Total Times Completed | 485 |
JavaScript Completions | 156 |
Ruby Completions | 42 |
Python Completions | 287 |
Scala Completions | 24 |
Total Stars | 43 |
% of votes with a positive feedback rating | 94% of 161 |
Total "Very Satisfied" Votes | 144 |
Total "Somewhat Satisfied" Votes | 16 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 10 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 7 kyu |