标签:
Given an 2D board, count how many different battleships are in it. The battleships are represented with ‘X‘s, empty slots are represented with ‘.‘s. You may assume the following rules:
1xN (1 row, N columns) or Nx1 (N rows, 1 column), where N can be of any size.Example:
X..X ...X ...X
In the above board there are 2 battleships.
Invalid Example:
...X XXXX ...X
This is not a valid board - as battleships will always have a cell separating between them.
Your algorithm should not modify the value of the board.
s
[LeetCode] Battleships in a Board 平板上的战船
标签:
原文地址:http://www.cnblogs.com/grandyang/p/5979207.html