Given N x M character matrix A of
Return the number of black shapes. A black shape consists of one or more adjacent
X's (diagonals not included)
The First and only argument is a N x M character matrix.
Return a single integer denoting number of black shapes.
1 <= N,M <= 1000 A[i][j] = 'X' or 'O'
Input 1: A = [ OOOXOOO OOXXOXO OXOOOXO ] Output 1: 3 Explanation: 3 shapes are : (i) X X X (ii) X (iii) X X
Note: 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.