youtube_tutorials
youtube_tutorials copied to clipboard
update sum_two_lists method
Fix edge case when the sum of the last nodes is greater than 10.
Can you give an explicit example on which the current code fails?
when 999 + 999:
9 -> 9 -> 9
- 9 -> 9 -> 9
The current logic is showing 998 instead of 1998. The proposal will save 19 in the last node of the single linked list and when you print the linked list, it will show the correct answer.
Please let me know your comments.