Dsa
Monotonic Stack
Easy
Broadcast Energy Reach
A series of radio stations are placed in a line, each with a specific power level. A station's signal 'reaches' all subsequent stations to its right until it encounters a station with a strictly greater power level. The 'Total Energy Reach' of a station is the sum of the power levels of all the stations its signal passes over (excluding itself and the station that blocks it). Calculate the Total Energy Reach for each station.
Input Format: A single line of space-separated integers representing power levels.
Output Format: A single line of space-separated integers representing the energy reach.
Example:
Input: 10 3 4 12
Output: 7 0 0 0
Key concepts
monotonic_stackprefix_sum
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now