prefix sum matrix mumble mumble
the biggest optimization is when you recognize that the original matrix already contains the information, you just need to count the right way
key insight is that in the first row and column, every cell that contains "1" is already a maximum "so far"; from there you can construct a secondary matrix that references the known surrounding cells to compute whether your current cell is part of a bigger maximum square