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.
If you can flip columns and/or rows an arbitrary number of times, there's always a solution to get the maximum numbers into the desired quadrant.
If you know that, then it's just a matter of identifying which numbers are the top numbers in the entire matrix. OP does this by only scanning indices in the top left quadrant and using the tilde operators to accordingly scan the other three quadrants.
What a great solution!
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Flipping the Matrix
You are viewing a single comment's thread. Return to all comments →
Yeah, this is absolutely brilliant.
If you can flip columns and/or rows an arbitrary number of times, there's always a solution to get the maximum numbers into the desired quadrant.
If you know that, then it's just a matter of identifying which numbers are the top numbers in the entire matrix. OP does this by only scanning indices in the top left quadrant and using the tilde operators to accordingly scan the other three quadrants.
What a great solution!