Given a grid of n*m consisting of O’s and X’s. The task is to find the number of ‘X’ total shapes.
Note: ‘X’ shape consists of one or more adjacent X’s (diagonals not included).
- Time : O(nm)
- Space : O(max(n,m))
c++
1 | class Solution { |