Duolingo Interview Question

optimization problem in 2d data (lots of index manipulation, medium)