题目:
题解:
func countBattleships(board [][]byte) (ans int) {
for i, row := range board {
for j, ch := range row {
if ch == 'X' && !(i > 0 && board[i-1][j] == 'X' || j > 0 && board[i][j-1] == 'X') {
ans++
}
}
}
return
}