Question bank › Dynamic Programming
Dsa Dynamic Programming Easy

Maximal Square of 1's

Given a binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Input: - The first line contains integers m and n (1 <= m, n <= 300). - The next m lines contain n integers (0 or 1) representing the binary matrix. Output: - A single integer representing the area of the largest square. Example: Input: 4 5 1 0 1 0 0 1 0 1 1 1 1 1 1 1 1 0 0 0 1 0 Output: 4

Key concepts

dynamic_programmingmatrixmaximum_square

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.