Given a binary matrix mat[][] of dimensions NxM such that 1 denotes land and 0 denotes water. Find the number of closed islands in the given matrix.
- Time : O(nm)
- Space : O(nm)
c++
1 | class Solution { |