Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
What is the commonality between security devices on the same row?
Each device on the same row has the same number of beams pointing towards the devices on the next row with devices.
If you were given an integer array where each element is the number of security devices on each row, can you solve it?
Convert the input to such an array, skip any row with no security device, then find the sum of the product between adjacent elements.