Hudson River Trading interview question

2D Matrix LeetCode Med/Hard question