Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 419. Battleships in a Board
Count how many non-adjacent battleships (each a straight 1×k or k×1 segment) appear in an m×n grid of 'X' and '.' cells. Because ships never touch, you can scan the board once and identify each ship by its starting cell (no 'X' above or to the left), achieving one-pass O(1) extra space.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.