Infection Spread with Recovery on a Grid (8 Directions)

Given an n x m grid where each cell is one of:

  • .: empty, no person; it cannot be infected and does not transmit infection;
  • H: a healthy person;
  • I: a person infected on day 0.

Rules:

1...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: