Largest square of ones
grid is a list of equal-length strings made of the characters 0 and 1. Return the area of the largest square, with its sides along the rows and columns, whose cells are all 1. If the grid has no 1 at all, return 0.
The grid has 1 to 200 rows and 1 to 200 columns. Aim for O(rows · columns) time.
Besides the tests, one large input (a 100×100 grid of ones) with a ~200 ms limit (scaled to your device's speed): brute force won't pass.
Examples
largest_square(["10111","11111","01111","11011"])→9largest_square(["1111","1111"])→4largest_square(["10","01"])→1