Given an m $ imes$ n matrix board where each cell is either a battleship 'X' or empty '.', return the total number of battleships on board.
Battleships can only be placed horizontally or vertically. That is, a battleship has a size of
Constraints:
m == board.length
n == board[i].length
m, n
board[i][j] is either '.' or 'X'
Given an m $ imes$ n matrix board where each cell is either a battleship 'X' or empty '.', return the total number of battleships on board.
Battleships can only be placed horizontally or vertically. That is, a battleship has a size of
Constraints:
m == board.length
n == board[i].length
m, n
board[i][j] is either '.' or 'X'