Question bank › Recursion
Dsa Recursion Medium

The Dissipating Pulse

A signal pulse starts at a specific cell (R, C) in a 2D grid with an initial energy E. The pulse spreads to the 4 adjacent neighbors. Each move costs '1 + |height_diff|' energy, where height_diff is the difference in cell values. The pulse stops spreading when its energy is less than the cost of the move. Calculate the total number of unique cells reached (including the starting cell). Input Format: Line 1: rows cols Next 'rows' lines: The grid values. Final line: startR startC initialE Output: Count of unique visited cells.

Key concepts

recursionflood fillgrid exploration

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.