java - Largest area in matrix -


i've been aksed write program finds largest area of equal neighbour elements in rectangular matrix , prints size. tried construct 2d array numbers think should switch using tree or in order solve problem. chould suggest possible way of solving it? example: enter image description here "hint: use algorithm depth-first search or breadth-first search."

sounds standard maze search problem. suggest use recursion find elements haven't been before have same number 1 have found. can either update matrix go or create copy keep track of cells have visited. don't need tree or additional complex data structure.

use algorithm depth-first search or breadth-first search

these 2 types of recursive searches. suspect implement both of these see how behave.


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -