Description is completely wrong


  • 2
    C

    Based on the description, there is no way that there are two different battleships in the following array.

    X..X
    ...X
    ...X
    

  • 1
    M

    The description is bad. The battleships don't have to be just ONE cell. In the example, I'll use 0's for water. The first battleship
    is at [1,1] and is 1 unit long. The second battleship STARTS at [1,4] and ENDS at [3,4] and is 3 unites long and includes [1,4], [2,4], [3,4]. If you draw a border around the two groups of "X", one will be the little "X" at [1,1] and the other one will be the long vertical one at the end.

      1  2  3  4
    [[X, 0, 0, X], 1
     [0, 0, 0, X], 2
     [0, 0, 0, X]] 3
                
    

    This will be another valid one with TWO battleships.

      1  2  3  4
    [[X, X, X, X], 1  <----- 1st ship
     [0, 0, 0, 0], 2
     [0, X, X, X]] 3   <----- 2nd ship
    
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.