Help me in solving STRAT2 problem

My issue

I think it’s applicable for [4,5,6,2,1] as well because we can {4,6,1}

Learning course: Dynamic programming
Problem Link: CodeChef: Practical coding for everyone