Optimal Binary search tree problem

this is standarad problem in geek for geeks.i am unable to think dynamic approach.please help me to solve this