floor_plan: floor_plan[i] is row i, where 1 marks a sensor and 0 marks an empty spot.
Two sensors are linked by a beam if they sit in different rows and no row strictly between them contains any sensor. Each such pair produces its own beam.
Count the beams.floor_plan=['1010', '0000', '0110', '1000'] → 6
The empty row 1 is skipped. Rows 0 and 2 give 2 · 2 = 4 beams, rows 2 and 3 give 2 · 1 = 2. That is 6 in total.
floor_plan=['111', '000'] → 0
All sensors share one row, and beams only run between different rows.
floor_plan=['1', '1', '1'] → 2
floor_plan) ≤ 500floor_plan[i]) ≤ 500, all rows have the same length0 and 1floor_plan=['1010', '0000', '0110', '1000']
6
Run checks the first 3 tests in your browser. Submit checks all 120 tests on the server, hidden ones included.