Largest Free Rectangular Floor Area in a Data Center Grid
Last updated: November 29, 2026
Quick Overview
Given a binary grid of a data center floor where 1 marks an empty tile and 0 marks an occupied one, return the area of the largest all-empty axis-aligned rectangle for placing a new rack row.
IBM
November 29, 20260
0
0 solved
Given a binary grid of a data center floor where 1 marks an empty tile and 0 marks an occupied one, return the area of the largest all-empty axis-aligned rectangle for placing a new rack row.
IBM runs data centers for IBM Cloud and client hosting, and placing new equipment in a fragmented floor plan is a fitting story for the maximal rectangle problem. Interviewers use it in hard onsite rounds to see whether you reduce the 2D problem to repeated histogram questions solved with a monotonic stack.
What the Interviewer Expects
- Build per-row histograms of consecutive empty tiles
- Solve largest rectangle in a histogram with a monotonic stack
- Use a sentinel to flush the stack at row end
- Explain why each bar is pushed and popped once
- State O(rows times cols) complexity
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you return the rectangle's coordinates?
- What if the rack row must be at least 2 tiles deep?
- How would you find the largest empty square instead, and is it easier?
- How does this change if tiles have weights and you need maximum weight?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: grid, a list of equal-length lists of 0 and 1. Output: the maximum area of a rectangle containing only 1s. Empty grid returns 0....
High-Level Design
For each row, let h[c] be the number of consecutive 1s ending at this row in column c (reset to 0 on a 0). The best rectangle whose bottom edge is this row equals the largest rectangle in histogram ...