islands are five as for each cell we assume all surrounding positions to be connected... so if coordinates are (x,y) then it is connected to (x+1, y), (x-1, y), (x+1, y+1), (x-1, y+1), (x+1, y-1), (x-1, y-1), (x, y-1), (x, y+1)
On Thu, Apr 11, 2013 at 9:35 AM, rahul sharma <[email protected]>wrote: > I didnt get..plz explain more...thnx > > > On Thursday, April 11, 2013, Don <[email protected]> wrote: > > Reformatting to make it easier to see: > > > > 11000 > > 01001 > > 10011 > > 00000 > > 10101 > > > > In this case an "island" is any set of "1's" which are connected > > vertically, horizontally, or diagonally. > > So the five islands are > > > > 11000 > > 01002 > > 10022 > > 00000 > > 30405 > > > > Don > > > > On Apr 10, 4:34 pm, rahul sharma <[email protected]> wrote: > >> {*1*,* 1*, 0, 0, 0}, > >> {0, *1*, 0, 0, *1*}, > >> {*1*, 0, 0, *1*, *1*}, > >> {0, 0, 0, 0, 0}, > >> {*1*, 0, *1*, 0, *1*} > >> > >> Can anybody eplain how there are 5 islands in above matrix..thnx in > advance > >> > >> source:-http://www.geeksforgeeks.org/find-number-of-islands/ > > > > -- > > You received this message because you are subscribed to the Google > Groups "Algorithm Geeks" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards, Arpit Sood -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
