Skip to content

Maximum square area in a binary matrix. DP. #206

@akshaygidwani404

Description

@akshaygidwani404

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions