You are given an `m x n` board where each cell is a battleship part `'X'` or empty `'.'`. Return the number of battleships on the board.
A battleship is a straight line of `'X'` cells, either `1 x k` (horizontal) or `k x 1` (vertical). No two battleships touch horizontally or vertically: at least one empty cell separates them.
**Follow up:** can you do it in one pass, with O(1) extra memory and without changing the board?
You are given an m x n board where each cell is a battleship part 'X' or empty '.'. Return the number of battleships on the board.
A battleship is a straight line of 'X' cells, either 1 x k (horizontal) or k x 1 (vertical). No two battleships touch horizontally or vertically: at least one empty cell separates them.
Follow up: can you do it in one pass, with O(1) extra memory and without changing the board?