Skip to content

Commit

Permalink
revised changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Unnati2603 committed Oct 31, 2024
1 parent d4b04ee commit 3c50429
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
19 changes: 0 additions & 19 deletions C++/Rotten Oranges/ques&explanation.txt

This file was deleted.

19 changes: 19 additions & 0 deletions C++/Rotten Oranges/rottenOrangesSol.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*
Problem Statement: For a given m x n grid, where each cell has the following values :
2 - represents a rotten orange
1 - represents a Fresh orange
0 - represents an Empty Cell
Every minute, if a Fresh Orange is adjacent to a Rotten Orange in 4-direction ( upward, downwards, right, and left ) it becomes Rotten.
Return the minimum number of minutes required such that none of the cells has a Fresh Orange. If it's not possible, return -1.
Example:
Input: grid - [ [2,1,1] , [0,1,1] , [1,0,1] ]
Output: -1
Time Complexity: O ( n x n ) x 4
Space Complexity: O ( n x n )
*/

#include <bits/stdc++.h>
using namespace std;

Expand Down

0 comments on commit 3c50429

Please sign in to comment.