Tekion | Phone | rotting-oranges
Anonymous User
967

Hi This is one of the question whic was asked in tekion I was not able to answer can anybody try for the solution.

Given a 2d matrix each cell can have values 0, 1, 2
0 - Null Cell
1 - Fresh Orange
2 - rotten Orange

every minute oranges present in 4 direction of rotten orange will also get rotten
return minimum to require to make all the fresh oranges rotten if not return -1

2 1 1
1 1 0
0 1 1

output: 4

Comments (2)