Why is answer wrong


  • 0
    H

    I just got the wrong answer for the following input

    [[0, 0, 1, 0, 1, 1, 1, 0, 1, 1], [1, 1, 1, 1, 0, 1, 1, 1, 1, 1], [1, 1, 1, 1, 1, 0, 0, 0, 1, 1], [1, 0, 1, 0, 1, 1, 1, 0, 1, 1], [0, 0, 1, 1, 1, 0, 1, 1, 1, 1], [1, 0, 1, 1, 1, 1, 1, 1, 1, 1], [1, 1, 1, 1, 0, 1, 0, 1, 0, 1], [0, 1, 0, 0, 0, 1, 0, 0, 1, 1], [1, 1, 1, 0, 1, 1, 0, 1, 0, 1], [1, 0, 1, 1, 1, 0, 1, 1, 1, 0]]
    

    0 0 1 0 1 1 1 0 1 1
    1 1 1 1 0 1 1 1 1 1
    1 1 1 1 1 0 0 0 1 1
    1 0 1 0 1 1 1 0 1 1
    0 0 1 1 1 0 1 1 1 1
    1 0 1 1 1 1 1 1 1 1
    1 1 1 1 0 1 0 1 0 1
    0 1 0 0 0 1 0 0 1 1
    1 1 1 0 1 1 0 1 0 1
    1 0 1 1 1 0 1 1 1 0

    The expected answer is

    0 0 1 0 1 2 1 0 1 2
    1 1 2 1 0 1 1 1 2 3
    2 1 2 1 1 0 0 0 1 2
    1 0 1 0 1 1 1 0 1 2
    0 0 1 1 1 0 1 1 2 3
    1 0 1 2 1 1 1 2 1 2
    1 1 1 1 0 1 0 1 0 1
    0 1 0 0 0 1 0 0 1 2
    1 1 1 0 1 1 0 1 0 1
    1 0 1 1 1 0 1 2 1 0

    but if you look at the original input, you can see that for the second row, the correct answer for bolded item should be as follow

    0 0 1 0 1 2 1 0 1 2
    1 1 2 1 0 1 1 1 4 5
    2 1 3 1 1 0 0 0 1 2
    1 0 1 0 1 1 1 0 1 2
    0 0 1 1 1 0 1 1 2 4
    1 0 1 2 1 1 1 2 1 4
    1 1 1 1 0 1 0 1 0 1
    0 1 0 0 0 1 0 0 1 2
    1 1 1 0 1 1 0 1 0 1
    1 0 1 1 1 0 1 2 1 0

    Why is that


Log in to reply
 

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