Question bank › Union Find
Dsa Union Find Medium

Disease Spread Simulation

You are working on a simulation of disease spread among a population. Each individual can become infected and can also recover. Given a series of infection events and recoveries, determine the total number of infected individuals after each event. Input the number of events and the events themselves, which are in the format 'infect a' or 'recover a'. Example: Input: 5 infect 1 infect 2 recover 1 infect 1 recover 2 Output: 2 2 2 1

Key concepts

union_findsimulationdisease_spread

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