Input{"matrix":[["1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"],["0","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","0"],["1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1","1"]]}
Expectednull
⏱ Performance - must finish in 2000ms
Large 20x20 matrix tests O(rows*cols) solution efficiency; brute force O(rows^2*cols^2) will time out.
✓ Efficient O(rows*cols) solution confirmed by passing performance test.