LeetCode
Battleships in a Board
Click
here
for an explanation.