Leetcode - Add Two Numbers (Python)

preview_player
Показать описание
January 2021 Leetcode Challenge
Leetcode - Add Two Numbers #2
Рекомендации по теме
Комментарии
Автор

I cant understand why leetcode output is "memory limit exceeded"

Nico_Fragale
Автор

Why do you need to convert from string to int to string? To me the problem doesnt necessarily imply theyre strings, it mentions digits.

Is there something implied I'm missing ?

abstract_machine
Автор

Came here to remind myself of how Linked List's even work lol. I didnt really do the same strategy as you.

Managed to get quite a shitty solution at first, but then optimized it quite a bit
So satisfying when it just clicks for you haha

Thank you mate! <3

Zerio
Автор

hello Tim! thanks for this video on how you showed us multiple solutions and way of thinking.
I just have a question regarding the first line where you put dummy=cur=listnode(), why did you do that?
like for example at the end couldn't youreturn just curr.next?

aceataya
Автор

Is the purpose of the dummy node so that you can hold onto a reference to the beginning of the result list after building it?

bigdrewpy
Автор

Can anybody explain me? In the begin we wrote "dummy = cur". After that we updating "cur" in the while-loop. But we don't update "dummy". So how "dummy" is updating together with "cur" if we don't redefine "dummy = ..."

ruslanruslan
Автор

Hi Tim! The part where you coded "if not n1" and "if not n2", could you explain what that means syntactically?

phillipwei