FastPrepSimulate Orchard Rot Spread
Problems/Simulate Orchard Rot Spread

Simulate Orchard Rot Spread

ZipRecruiter logoZipRecruiter● MediumNEW GRADOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Four ZipRecruiter new-grad OA reports describe the orchard symbols, orthogonal rot spread, the requested days, and the returned grid. A pasted day-two example did not fit, and we settled it with a step where all cells change at the same time, based on our recorded evidence. We supplied a String[] row input and limits.

An orchard is a rectangular array of strings using - for empty, T for healthy trees, and R for rotten trees.

Each day is synchronous: trees rotten at the start of the day infect orthogonally adjacent healthy trees; newly rotten trees begin spreading the next day.

Return the orchard after exactly days days.

Function

simulateOrchard(orchard: String[], days: int) → String[]

Examples

Example 1

orchard = ["RT-","TTT"]days = 1return = ["RR-","RTT"]

Only trees adjacent to the original rotten tree change on day one.

Example 2

orchard = ["R-T","TTT"]days = 0return = ["R-T","TTT"]

Zero days leaves the orchard unchanged.

Constraints

  • 1 <= rows,columns <= 200
  • 0 <= days <= 100000

More ZipRecruiter Online Assessment questions

  • Four-Level Banking System with Scheduled PaymentsOA · Seen Oct 2026
  • Count Three-Digit Numbers with Distinct DigitsOA · Seen Oct 2024
  • Longest Frequency-Bounded SubarrayOA · Seen Oct 2024
  • Minimum Changes to Draw a YOA · Seen Oct 2024
  • Apply Binary State OperationsOA · Seen Sep 2024
  • Compare Odd- and Even-Index SumsOA · Seen Sep 2024
  • Coordinate Removals with Column GravityOA · Seen Sep 2024
  • Lexicographically Smallest End ReversalOA · Seen Sep 2024
  • Recursively Expanded Shell Command CountsOA · Seen Sep 2024
  • Count Case-Insensitive Key ChangesOA · Seen Sep 2024

Similar questions at other companies

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

ZipRecruiter interview experiences

  • ZipRecruiter SWE OA, Level Not Reported: 23 Experiences
  • ZipRecruiter SWE Intern OA Scores: 4 Experiences
  • ZipRecruiter SWE New Grad OA: 9 Experiences
All ZipRecruiter interview questionsSee ZipRecruiter hiring insights
Saved
class Solution {
    public String[] simulateOrchard(String[] orchard, int days) {
        // Write your code here.
    }

}
Checking account…