Why can't be use memo array values to find the path? If its already containing the max sum for each idx,count. Then instead of calling recursion when finding path, we can just used the memo array values right?
Its the same logic. You may have to take Count = 4 in that case to cover all cases from 0 to 3. Your idea will work too. Please use table instead of calling memoization :)
awesome solution sir
thanks
Sir, why is the runtime so much low for your solution?
What an explanation Sir🔥🔥. Question is hard due to the part of finding the path for the maximum sum.
yes
thanks :)
Thank you sir ;)
welcome:)
instead of prefix sum, we can simply calculate the sum of each windows and store it, that would be simpler I beleive.
wouldnt that be N^2 ?
@@techdose4u no, O(n) only, we apply sliding window algorithm to calculate sum of windows until the last possible window for given k.
Thankyou sir great explaination
welcome :)
what a great explanation
Thanks :)
What an explanation sirji!!!
Thanq Ji :)
helpful
Glad it helped
Why can't be use memo array values to find the path? If its already containing the max sum for each idx,count. Then instead of calling recursion when finding path, we can just used the memo array values right?
Its the same logic.
You may have to take Count = 4 in that case to cover all cases from 0 to 3.
Your idea will work too.
Please use table instead of calling memoization :)