A page builder shows the page as a grid of cells. layout is an array of strings where "." is a free cell and "#" is a cell already used by a component.
Write largestFreeSquare(layout) that returns the side length of the largest square block made only of free cells, so a new square widget can be dropped there. Return 0 if no cell is free.
Input: layout = ["....","....","...#"] Output: 3
The 3 by 3 block in the top-left corner is all free.
Input: layout = ["##","##"] Output: 0
No cell is free.
1 <= layout.length, layout[0].length <= 2000. and #.Run tries your code on the examples. Submit runs every test, including hidden edge cases and big inputs that check your code is fast enough, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #505 Largest Empty Square in a Layout. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.