FastPrepPlant Infection Simulation, Part 4: Death Countdown
Problems/Plant Infection Simulation, Part 4: Death Countdown

Plant Infection Simulation, Part 4: Death Countdown

OpenAI logoOpenAI● HardFULLTIMENEW GRADPHONE SCREENONSITE INTERVIEW

Updated Dec 2026

QuestionExamples

Problem statement

This part adds a death countdown to the infection-and-recovery simulation.

Each input cell is X (infected), . (healthy), or I (immune). Immune cells never become infected and never transmit infection. Dead cells are terminal and never transmit infection.

Daily Update Rules

At the start of each day, count infected cells among each cell's eight horizontal, vertical, and diagonal neighbors. Using that start-of-day state:

The problem statement continues
Pro

Examples

Example 1

grid = ["X."]infectionThreshold = 2duration = 1deathThreshold = 1return = [2, 1]
grid
010X.

On day 1, the healthy cell has one infected neighbor, so it starts a death countdown but does not meet the infection threshold. The initial infection recovers. The countdown finishes at the end of day 2, producing one death.

FastPrep Pro
Reported in 1 OpenAI interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • Worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week

More OpenAI Phone Screen questions

  • Rectangle Point Coverage CountsPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Sparse Plant Infection SimulationPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Prefix Matrix Products and AutogradPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 1: Batch EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 2: Numerically Stable EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 3: Block-wise EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Streaming Entropy, Part 4: Stable Streaming EntropyPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Secret Number Search with One-Call-Delayed FeedbackPHONE SCREEN · Seen Nov 2026
  • Determine the Winner of Three-Card HandsPHONE SCREEN · Seen Nov 2026
  • Grid Infection with Recovery After D DaysPHONE SCREEN · Seen Nov 2026

Similar questions at other companies

  • Multi-Head Attention Forward PassMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Implement Multi-Head AttentionByteDance · PHONE SCREEN · ONSITE INTERVIEWByteDance interview questions
  • Count Islands from Streaming RowsAmazon · ONSITE INTERVIEW
  • Zigzag Board Adjacent SwapsUber · PHONE SCREENUber interview questions
  • Cache Shared Image Pipeline PrefixesAnthropic · ONSITE INTERVIEWAnthropic interview questions
  • Cats, Rabbits, and Snails Board GameAsana · ONSITE INTERVIEW
  • Ultimate Tic-Tac-Toe Move SimulatorHebbia · PHONE SCREEN
  • Transformer Attention and SwiGLU Forward PassGoogle · ONSITE INTERVIEWGoogle interview questions
  • Self-Attention and Causal Masked Self-AttentionMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • 2D Convolution Layer Forward PassWaymo · PHONE SCREENWaymo interview questions

OpenAI interview experiences

  • OpenAI OA: What It Tests (2026)
All OpenAI interview questionsSee OpenAI hiring insights
CodePython 3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import heapq
from collections import defaultdict
 
class Solution:
def solve(self, values, queries):
# Build the adjacency structure
n = len(values)
graph = defaultdict(list)
for u, v in queries:
graph[u].append(v)
 
best = [float("inf")] * n
heap = [(0, 0)]
while heap:
cost, node = heapq.heappop(heap)
if cost > best[node]:
continue
Run and Submit unlock with Pro
FastPrep Pro
Reported in 1 OpenAI interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • Worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week