Harpreet's Newsletter

Harpreet's Newsletter

Rotting Oranges

Salesforce Interview Question

Harpreet Singh's avatar
Harpreet Singh
Mar 23, 2026
∙ Paid

Problem Overview

Difficulty: Medium
LeetCode Pattern: BFS

You are given an m x n grid where each cell can have one of three values:

  • 0 representing an empty cell,

  • 1 representing a fresh orange, or

  • 2 representing a rotten orange.

Every minute, any fresh orange that is 4-directionally adjacent to a rotten orange becomes rotten.

Return the minimum number of minutes…

User's avatar

Continue reading this post for free, courtesy of Harpreet Singh.

Or purchase a paid subscription.
© 2026 Harpreet Singh · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture