minimize_smoke gives us the smole generated to combine i and k and same of the other part
and now we have to combine the both and calculate the total smoke generated
i am not geeting ??? how the function sum(i ,k ,arr) givees us the smoke generated these functions are giving us the colour left
can you please gry run the code on (40,60, 20) example
Long long temp= minimize_smoke(arr,i,k) + minimize_smoke(arr, k+1,j) + sum(i,k,arr)*sum(k+1,j,arr);
hello @anshulgurawalia
we break the problem at k.
[i…j] -> [i…k] , [k+1…j]
sulution of [i…j] = solution [i…k] + solution [k+1…j] + cost of combining.
cost of combining = sum of mixture a * sum of mixture b
= sum [i…k] * sum [k+1…j]
we are doing same thing here.
rewatch the video once again u will get it.
a simple example->
[40,60]-> solution [40] + solution [60] + combining [40] and [60]
-> 0 + 0 + 40 * 60
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.