Skip to content

A little bug in No.2 Add two numbers #2014

Open
@Travelmind

Description

@Travelmind

The while condition should add carry != 0, like this:

while( l1 != null || l2 != null || carry ==1){
}

otherwise, it cannot pass the test case like:
[9,9,9,9,9,9,9]
[9,9,9,9]

output should be:
[8,9,9,9,0,0,0,1]
but it missed the highest [1]

thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions