5 kyu
myjinxin katas #001 : Rotate, Remove, Return
166 of 331myjinxin2015
Description:
Description
Give you a 2D array(n * n, n is an odd number more than 1), rotate it, remove elements, return the last surviving number.
arr=[
[3,5,8,4,2],
[1,9,2,3,8],
[4,6,7,2,2],
[7,5,5,5,5],
[6,5,3,8,1]
]
Rotate it in a counter clockwise direction:
2,8,2,5,1
4,3,2,5,8
8,2,7,5,3
5,9,6,5,5
3,1,4,7,6
Remove 1 maximum value and 1 minimum value of each row(remember, only remove 1 maximum value and 1 minimum value, not all of same, remove from left side)
2,2,5
4,3,5
7,5,3
6,5,5
3,4,6
Rotate again:
5,5,3,5,6
2,3,5,5,4
2,4,7,6,3
Remove again:
5,5,5
3,5,4
4,6,3
Rotate again:
5,4,3
5,5,6
5,3,4
Remove again:
4
5
4
Rotate again:
4,5,4
Remove again:
4
Return the last surviving number 4
Task
Complete function rotateAndRemove
that accepts 1 argument arr
. Returns the result in accordance with the rules above.
Puzzles
Algorithms
Arrays
Similar Kata:
Stats:
Created | Sep 15, 2016 |
Published | Sep 15, 2016 |
Warriors Trained | 762 |
Total Skips | 36 |
Total Code Submissions | 1823 |
Total Times Completed | 331 |
JavaScript Completions | 166 |
Python Completions | 166 |
Rust Completions | 7 |
Go Completions | 9 |
Total Stars | 30 |
% of votes with a positive feedback rating | 93% of 91 |
Total "Very Satisfied" Votes | 80 |
Total "Somewhat Satisfied" Votes | 9 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 4 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 6 kyu |