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: "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
Post a Comment