# Don't understand the question

• Look at the example input : (2->4->3)+(5->6->4), why the output is the single link list 7->0->8. How do those numbers calculated?

• It's quite simple. They are in reversed order, so the first one is 342 and second one is 465. Adding them up gives us 807.
I think they are reversed to make it a little easier to compute.

• Thanks, I see what is going on. Each individual link represents a number.

• @jerry_lin Each individual link represents not a number but a digit.

• It's actually not a good example input since 243 + 564 is the same as 342 + 465, i.e. both equal 807...

It would be better to have an input that makes it clear you have to add together the reversed numbers to get the answer.

• Look at the example input : (2->4->3)+(5->6->4), why the output is the single link list 7->0->8. How do those numbers calculated?

We have l1=343, l2=261 when add(l1,l2) we have 3+2=5, 4+6=10 | 1 carry to next, second digit set to 0, 3+1=4 but 4 + carry = 5, add(l1,l2) = 505, task have a bad description as my english.

• It's actually not a good example input since 243 + 564 is the same as 342 + 465, i.e. both equal 807...

It would be better to have an input that makes it clear you have to add together the reversed numbers to get the answer.

agree, it is a bad example.

• @deivpetrov
hey ! bro, what's mean of "but 4+carry = 5" where's the carry come from?

• @jerry_lin i think 342+564=807

• Should we suppose these two list contains the same number of digits?

• @chunheng This is a great question to ask the interviewer. From my tests, we need to consider different sized lists.

• It's hard for me to understand……
why not 7->10->7
it's to mean : 2+5=7, (7/10+4+6)%10=0 , 7+10/10 ???

• @ilovejhzzh 342+564 = 906
243 + 564 = 807

• It's not hard.
They show the first is ones,the second is tens and the third is hundreds. So input (2 -> 4 -> 3) <==> 342 + (5 -> 6 -> 4) <==> 465 = output (7->0->8) <==> 807.

• Sorry, I just don't know the length problem. How is 0.123456+0.876 saved in this question?Is that 6->5->4->3->2->1 and 0->0->0->6->7->8?Please help me...

• Oh each list represents one number. I completely misread the question too.

• It is still unclear to me, should we consider the case when each number is represented by differing number of digits?

Example:

Suppose we try to add 1- > 5 (51) and 0 -> 1 -> 3 (310) (51 + 310).

Should our program be able to handle the case described above?

• I thought I understood the requirements, but there's a test case tripping me up.
What should the answer be for [1,8] and [0]?

My solution was: [8,1]

But they say it's [1,8]

Shouldn't it be calculated like so:

1. Reverse list 1: [8,1]
2. Reverse list 2: [0]
3. Ones column = 1 + 0 = 1
4. 10's column = 8 + 0 = 8

[8,1]

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