nice solution， My brain is not geiliful
Nice solution. But it is tricky to come up with this
one in an interview.
how to discover this regularities?
I like the answer. It makes lot of sense.
I personally did it a bit cheaper way but a dynamic programming is better.
Here is what I did in Python:
You inspired me a lot! Thank you.
No one has replied
Thx! Good solution! but how do you konw the sentence in the loop should plus 1？
And this is the python answer.
this is mine~
@startingwars How is this O(n)? You have that list comprehension in the loop, shouldn't it be O(n*(n+1)/2) about O(n^2)?
get it, thank you very much.
how to count the every number? could you explain it? Thx!
Thanks for sharing your idea.
I learned a lot!
Same solution with more clear code snippet.
For example, 7 = 4+3; then dp = dp + dp;
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.