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 <rahul23111...@gmail.com> 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 algogeeks+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to