Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Travelmind opened this issue Oct 20, 2021 · 1 comment
Open

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

Travelmind opened this issue Oct 20, 2021 · 1 comment

Comments

@Travelmind
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@Travelmind and others