Battleships in a Board at Microsoft

Medium77.3% acceptance

This problem has 37.5% frequency at Microsoft.

Problem Description

Given an `m x n` matrix `board` where each cell is a battleship `'X'` or empty `'.'`, return _the number of the**battleships** on_ `board`. **Battleships** can only be placed horizontally or vertically on `board`. In other words, they can only be made of the shape `1 x k` (`1` row, `k` columns) or...

Read full problem and hints

Topics

Also asked at 7 companies


More Microsoft Questions

View all Microsoft questions