I am trying to solve this question from leetcode.
813. Largest Sum of Averages
I am not able to come up with a good logic.
Can you suggest some idea… which involved recursive approch, which we can memoized later.
Thanks
I am trying to solve this question from leetcode.
813. Largest Sum of Averages
I am not able to come up with a good logic.
Can you suggest some idea… which involved recursive approch, which we can memoized later.
Thanks
helllo @ashishnnnnn
make one partition and call same function on remaining array.
solve(i,k) = avg(i,j) + solve(j+1,k-1) // if partition is at index j then now we need to solve for j+1 onward
value of j can be from j=i to j=n-1 , pick that answer which is maximum
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.