Longest Path in a Matrix (Adobe Interview Problem)

Revision en3, by gouravkrosx, 2021-08-30 19:28:42

A matrix of 0’s and 1’s is given, you have to find largest adjacent string of 1’s, you cannot traverse a cell more than once. A pair of 1’s is adjacent if they are in immediate up, down, right or left cells.

Ex:

0 0 0 0 0
0 0 1 0 0 
1 1 1 0 0 
0 0 1 1 0

ans-5
(not 6 as they are not asking size of largest block!) (2,0 -> 2,1 -> 2,2-> 3,2 -> 3,3)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English gouravkrosx 2021-08-30 19:28:42 4
en2 English gouravkrosx 2021-08-30 19:28:02 14
en1 English gouravkrosx 2021-08-30 19:27:05 412 Initial revision (published)