A dashboard builder lays widgets on a grid. grid is an array of equal-length strings, one per row, where . is a free cell and # is taken by a widget.
Write largestFreeBlock(grid) that returns the area (number of cells) of the largest rectangle made only of free cells, with sides along the grid lines. Return 0 if no cell is free.
Input: grid = ["#.#..","#.###","....#","#..#."] Output: 4
Row 2 columns 0 to 3 are free: area 4. No bigger free rectangle exists.
Input: grid = ["..",".."] Output: 4
The whole 2 by 2 grid is free.
1 <= grid.length <= 20001 <= grid[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 #269 Largest Free Block on a Layout Grid. 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.