DSA
DSA copied to clipboard
Maximum square area in a binary matrix. DP.
Given a binary matrix, find out the maximum size square sub-matrix with all 1s. For example, consider the below 6x5 binary matrix:
{0, 1, 1, 0, 1} {1, 1, 0, 1, 0} {0, 1, 1, 1, 0} {1, 1, 1, 1, 0} {1, 1, 1, 1, 1} {0, 0, 0, 0, 0}
Output: 9 Explaination: Largest square matrix possible is 1 1 1 1 1 1 1 1 1 here side is 3 units hence area = 9.