Given N * M field of
Return the number of black shapes. A black shape consists of one or more adjacent
X's (diagonals not included)
OOOXOOO OOXXOXO OXOOOXO answer is 3 shapes are : (i) X X X (ii) X (iii) X X
Note that we are looking for connected shapes here.
XXX XXX XXX
is just one single connected black shape.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.