Click here to see the full article post
The end of our second loop for i = 0..N-1 represents finishing the calculation of the correct value for dp(i, t)
is it dp(i,t) or dp(i,k)?
Why the answer for
is not 20.5? We can split the list into [1,2,3,4]   , which will give us 20.5
@panwu5588 you can't sort the given list. If the input is [1,2,3,4,5,6,7] 4 the answer should be 20.5
This actually does breaks up the problem in a way where it's more understandable. Once you understand that, then it might help understand the bottom up approach presented here.
In the solution, the runtime is about the same but the difference is the space of O(N) vs. O(N*K).
@elvinyang why you cant sort the list?
The expected answer for
4 is 18.16667 which isnt making sense to me.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.