CHEFTWOS Editoral

Qstn:CodeChef: Practical coding for everyone

Solution:CHEFTWOS - Editorial - editorial - CodeChef Discuss

I have read the editorial many times but I can’t understand 2nd step that is swaping (Final Solution)
can anyone help me by explaining in details.I am new to dynamic programming so please explain in detail.

Thank You