FastPrepSimulate Orchard Rot Spread
Problems/Simulate Orchard Rot Spread

Simulate Orchard Rot Spread

Airbnb logoAirbnb● MediumINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Airbnb intern online assessment. The task is to return the orchard grid after rot spreads from rotten trees to their healthy neighbors for a given number of days.

The report gives the full task and one example, which is Example 3 here. It gives no size limits. It only says that checking every cell once per day is fast enough, so we chose up to 50 rows, 50 columns and 1,000 days. The report gives the grid as rows of single characters. Here, each row is one string.

Our version is about 95% the same as the reported question.

Special thanks: 🌷 A special thank you to a lovely, amazing fren for sharing that this question appeared in an interview on November 23, 2026! ( ᴗ͈ˬᴗ͈)ഒ 💜

Given an orchard grid orchard and an integer days, return the orchard after exactly days days.

The orchard is a rectangular array of strings. Each character is - for an empty cell, T for a healthy tree, or R for a rotten tree.

Each day, every tree that is rotten at the start of the day rots its healthy neighbors directly above, below, left, and right. All changes in a day happen at the same time, so a tree that rots today starts spreading rot the next day.

Function

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

Examples

Example 1

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

The rotten tree at the top-left rots the tree to its right and the tree below it. The other trees are not next to it, so they stay healthy.

Example 2

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

Zero days leaves the orchard unchanged.

Example 3

orchard = ["TR--","-TTR","TT-R","--R-"]days = 2return = ["RR--","-RRR","TR-R","--R-"]

Cells are named (row, column), counting from 0. The trees at (2, 3) and (3, 2) start rotten, but they have no healthy neighbors, so they never rot anything. On day 1, the rotten tree at (0, 1) rots (0, 0) and (1, 1), and the rotten tree at (1, 3) rots (1, 2). On day 2, (1, 1) rots (2, 1). The tree at (2, 0) touches only (2, 1), which rotted on day 2, so it is still healthy after day 2.

Constraints

  • 1 <= rows,columns <= 50
  • 0 <= days <= 1000

More Airbnb Online Assessment questions

  • Count Card Duel RoundsOA · Seen Nov 2026
  • Count Lamps Lighting Each PointOA · Seen Nov 2026
  • Sort Adjacent PairsOA · Seen Nov 2026
  • In-Memory File SystemOA · Seen Nov 2026
  • Task Management SystemOA · Seen Nov 2026
  • Recipe Management SystemOA · Seen Nov 2026
  • Progressive Banking SystemOA · Seen Nov 2026
  • Credit Accounts with Scheduled TransfersOA · Seen Oct 2026
  • Parcel Attribute Store with TTLOA · Seen Oct 2026
  • Parcel Event TrackingOA · Seen Oct 2026

Similar questions at other companies

  • Simulate Orchard Rot SpreadCapital One · OACapital One interview questions
  • Simulate Orchard Rot SpreadZipRecruiter · OAZipRecruiter interview questions
  • 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

Airbnb interview experiences

  • Airbnb OA · November 2026
  • Airbnb Campus and Full-Time SWE OA / Interviews: 9 Experiences
  • Airbnb Intern Phone Interviews: 21 Experiences (Part 7 of 7)
  • Airbnb Intern OA and Phone Screens: 17 Experiences (Part 6 of 7)
  • Airbnb Intern OA and Onsite Rounds: 16 Experiences (Part 5 of 7)
  • Airbnb Intern OA, Diplomacy Game: 19 Experiences (Part 4 of 7)
All Airbnb interview questionsSee Airbnb hiring insights
Saved
class Solution {
    public String[] simulateOrchard(String[] orchard, int days) {
        // Write your code here.
    }

}
Checking account…