LeetCode Weekly Contest 39
No one has replied
Feels like magic
Can you please explain the logic ?
I also came up with a similar solution in C++. I have written my solution along with a verbose thought process to hopefully help other folks better understand this formula: https://discuss.leetcode.com/topic/102738/very-easy-to-understand-c-with-explanation
what do you mean first element
1.It's not in the first element,
2.It's in the position of the first element,s
@dreamchase said in Java range query using TreeMap.subMap():
I got this error: error: cannot find symbol: class NavigableMap
@qsj and @nevs this solution is taking too much time creating the dp storage list of size n+1. The largest value of n is 10^6, so try changing this one line of code as follows:
Old code: a = [0 for _ in range(1000050)]
New code: a =  * 1000001
With that one line code change, this solution is ACCEPTED in Runtime: 906 ms.
@dongll Then why not replacing db from list to map too?
@qsj why did you do so? for n = 1, you also assign such an array for it. Then, of course it will lead to TLE.
Disabled Categories are greyed out
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.