← All questions
Coding
Find the Largest Submatrix with all 1s
Asked at
DoorDash
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
- 01Clarify whether columns may be rearranged.
- 02Accumulate consecutive-one heights per column.
- 03For fixed columns, solve largest rectangle in histogram.
- 04For rearrangeable columns, sort heights each row.
- 05Track maximal area and test zero resets.
Reference answer
Then expect these follow-ups
Why does a monotonic stack find every maximal rectangle?
Tests: correctness reasoning
What changes if columns can be permuted?
Tests: constraint adaptation
Hiring now
DoorDash has 342 open roles right now
landed applies to roles like these for you, on each company’s own site, with answers written for the role.
Get 5x interviews10 free auto-applies. No card.
Senior Software Engineering, Backend (All Teams) - Vaga para mulheres
São Paulo, Brazil
Senior Software Engineering, Backend (All Teams) - Vaga exclusiva para PCD
São Paulo, Brazil
Senior Software Engineering, Backend
Hyderabad, India
Next question