Dsa
Heap
Easy
Synchronized Pulse
You are monitoring K scientific sensors. Each sensor i produces a pulse starting at time T_i and repeats every P_i milliseconds (i.e., at T_i, T_i + P_i, T_i + 2P_i, ...). All pulses are recorded in a single global timeline. Find the time of the M-th pulse to occur across all sensors. (Note: Pulses at the same time are counted separately).
Example:
K=2 sensors, M=3 pulses.
Sensor 0: Start 5, Period 10 (Pulses: 5, 15, 25...)
Sensor 1: Start 7, Period 5 (Pulses: 7, 12, 17...)
Timeline: 5, 7, 12, 15, 17...
3rd pulse is at time 12.
Key concepts
heapmathmerge-k-sorted
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