can someone provide editorial for this question?

I am a beginner and need some help.


See my discussion of my approach to this question here

@joffan can u please elaborate the approach i cannot understand the DP Soln (I read yours) i am a newbie in DPs please help thank you :smiley: