Maximal Square

Medium · Dynamic Programming · about 20 minutes

Asked at Google, Amazon, Meta, Microsoft, Apple.

Given an m × n binary matrix of 0s and 1s, find the largest square containing only 1s and return its area.

Related guides