Skip to main content
All Questions

Find the maximum side length of two equal, non-overlapping all-true squares in a boolean grid.

Unlock detailed company stats for this questionUpgrade

Given an N x M boolean grid representing a map, where A[R][C] = true means a solar power plant can be built on that cell and false means it cannot. Place two square-shaped power plants such that both squares are the same size, every cell inside each square is true, and the two squares do not share any cell. A single cell (1x1) counts as a valid square. Find the maximum possible side length of the two equal squares.

Constraints: N, M <= 700.

Closest LeetCode problem: 221 (Maximal Square), which only covers the base DP.

Format · Online assessment.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.