• + 2 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!