FastPrepDays Until Poisoned Plants Stabilize
Problems/Days Until Poisoned Plants Stabilize

Days Until Poisoned Plants Stabilize

Apple logoApple● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Apple full-time phone screen. The report directly gives the binary grid, a threshold on the eight neighbors, daily updates that happen all at once, the number of days until things stop changing as the output, and a goal of O(m*n) with BFS. We chose the function signature and the input limits.

Special thanks: 🌷 A special thank you to a lovely, amazing fren who shared that this question appeared again on October 21, 2026! (∩˃o˂∩)♡ 🩷

Given a rectangular binary grid of plants and an integer k, return the number of days until a full day would produce no additional poisoned plants.

In the grid, 1 is poisoned and 0 is healthy. At the end of each day, every healthy plant with at least k poisoned neighbors becomes poisoned. All changes for a day happen at the same time. A plant's neighbors are the up to eight cells touching it horizontally, vertically, or diagonally.

Function

daysUntilPlantsStabilize(grid: int[][], k: int) → int

Examples

Example 1

grid = [[1,0,0],[0,0,0],[0,0,0]]k = 1return = 2
grid
012010010002000

On day 1 the cells touching the poisoned corner become poisoned. Every remaining cell then touches one of them, so all of them change on day 2, which is the answer.

Example 2

grid = [[1,0],[0,0]]k = 2return = 0
grid
01010100

No healthy plant has at least k poisoned neighbors, so the grid never changes and no days are counted.

Constraints

  • 1 <= grid.length, grid[i].length <= 500.
  • Every cell is 0 or 1, and every row has the same length.
  • 1 <= k <= 8.

More Apple Phone Screen questions

  • Subarray Product Less Than KPHONE SCREEN · Seen Nov 2026
  • Evaluate DivisionPHONE SCREEN · Seen Nov 2026
  • Reverse a Linked ListPHONE SCREEN · Seen Nov 2026
  • Validate a BST with a Custom ComparisonPHONE SCREEN · Seen Nov 2026
  • Design a Food Rating SystemPHONE SCREEN · Seen Oct 2026
  • Capture Surrounded Regions with Union-FindPHONE SCREEN · Seen Oct 2026
  • Maintain a Consistent-Hashing RingPHONE SCREEN · Seen Oct 2026
  • Count Nodes in a ChainPHONE SCREEN · Seen Oct 2026
  • Run-Length DecodingPHONE SCREEN · Seen Oct 2026
  • Implement Hit CounterPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Grid Infection with Recovery After D DaysOpenAI · PHONE SCREENOpenAI interview questions
  • Process Minesweeper Game OperationsAmperity · PHONE SCREENAmperity interview questions
  • Xiangqi Horse ReachabilityeBay · PHONE SCREENeBay interview questions
  • Drop and Eliminate Adjacent PiecesSnowflake · PHONE SCREENSnowflake interview questions
  • Explore an Unknown Grid and Find a PathLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Minesweeper Board UpdateUber · ONSITE INTERVIEWUber interview questions
  • Minesweeper Board UpdateClay · ONSITE INTERVIEW
  • Simulate Orchard Rot SpreadZipRecruiter · OAZipRecruiter interview questions
  • Minesweeper Board UpdateAirbyte · ONSITE INTERVIEW
  • Competitive ForagingAkuna Capital · OAAkuna Capital interview questions

Apple interview experiences

  • Apple SWE Phone Screen: Subarray Products: 1 Experience
  • Apple New Grad SWE Java, Coding and Manager Rounds: 1 Experience
  • Apple AI Coding and Related Interviews: 17 Experiences
  • Apple India SWE New Grad Interviews: 5 Experiences
  • Apple New Grad SWE Phone Screens: 12 Experiences (Part 3 of 3)
  • Apple New Grad SWE and Embedded: 16 Experiences (Part 2 of 3)
All Apple interview questionsSee Apple hiring insights
Saved
class Solution {
    public int daysUntilPlantsStabilize(int[][] grid, int k) {
        // Write your code here.
    }
}
Checking account…