panel: 1 means the bulb is on, 0 means it is off.
Find the longest straight line of lit bulbs that follow one another with no gaps. The line may be horizontal, vertical, or run along either of the two diagonal directions. Return its length, the number of bulbs in it.
If no bulb is lit, return 0.panel=[[1, 0, 1], [0, 1, 1], [1, 0, 1]] → 3
The right column is fully lit, three bulbs in a vertical line. The diagonal from the top-left corner breaks on the bottom row.
panel=[[0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0], [1, 1, 1, 0]] → 4
The anti-diagonal from the top-right corner to the bottom-left one has 4 bulbs.
panel=[[0, 0], [0, 0]] → 0
No bulb is lit, so the answer is 0.
panel=[[1, 0, 1], [0, 1, 1], [1, 0, 1]]
3
Run checks the first 3 tests in your browser. Submit checks all 94 tests on the server, hidden ones included.