Comments

Hey ! Yeah it seems a bit confusing but you can approach it like this as well ,

let dp[i] = number of partitions possible if the last string ends at index i .

for this you have to check for every substring ending at index i and check if it is a valid one .Let the string be j.....i .

If it is valid simply add dp[j-1] to dp[i] .i.e these much partitions can be made by having last string as s[j.....i] .

Coming to the base case :

You can have it as :

dp[0] = 1 where 0 indicates the first letter of the given string as there is only one way to split a single character .i.e the character itself.

and dp[n-1] will be the answer .

Can refer my submission : link

Can you explain what is being done over here in this code !

thanks YangZhao512 Errichto :) I got it .

in tower of cubes why a and a-1 are the possible options why not a-2 or less ? Although it seems to be working for smaller values but I am not able to figure it out why it will work for each case for sure ! Can anyone help ?

thankyou , i got the point :)

In div2-C tutorial :

Clearly, changing the elements of the array to any element larger than max won't be optimal, because the last operation is for sure multiplying all the elements of the array by two. And not doing this operation is of course a better answer.

can this thing be proved ?

@minsu the confusing thing is the time multiple of c when e becomes b'. please exlpain this step .

can any body explain the div2 C in a bit detail. what i was thinking is : calculate time in which h1 changes to a1 and then calculate time in which a1 changes again to a1.

but after that whole thing is getting messed up .