3964. Minimum Lights to Illuminate a Road
You are given an integer array
lightsof lengthn, representing positions 0 throughn - 1on a road.For each position
i:
- If
lights[i] = v, wherev > 0, there is a working bulb at positionithat illuminates every position frommax(0, i - v)tomin(n - 1, i + v), inclusive.- If
lights[i] = 0, there is no working bulb at positioni.A position is visible if it is illuminated by at least one working bulb.
You may install additional bulbs at any positions. Each additional bulb installed at position
jilluminates positions frommax(0, j - 1)tomin(n - 1, j + 1), inclusive.Return the minimum number of additional bulbs required to make every position on the road visible.
1 | class Solution { |