### c - Dynamic programming - Largest square block - Stack ...

I am not sure if this algo can be used for your huge file, but you don't need to store entire matrix T but only current and previous lines only. Following notes can help to undestand general idea: all squares with right bottom angles (i-1, j), (i, j-1), (i-1, j-1) with size s are inside square of with right bottom angle (i, j) with size …