We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I'll look at the input constraints then decide if brute force will do it. For example 10^9 rotations suggests I'd better use modulo arithmetic. If there's a mathematical way to solve a problem, it will be much faster than consuming clock cycles in nested iterations. For me, the key to this one was finding a mapping from 'polar' to 'mercator' coordinates, because you are spinning rings of numbers around the matrix.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Matrix Layer Rotation
You are viewing a single comment's thread. Return to all comments →
I'll look at the input constraints then decide if brute force will do it. For example 10^9 rotations suggests I'd better use modulo arithmetic. If there's a mathematical way to solve a problem, it will be much faster than consuming clock cycles in nested iterations. For me, the key to this one was finding a mapping from 'polar' to 'mercator' coordinates, because you are spinning rings of numbers around the matrix.