How to solve this problem ? Please Help in Logic.

directi
problem

#1

Please tell how to solve this problem and how should we code this ?
Problem


#2

I’d say it’s dynamic programming: the min. number of letters necessary to represent substring [i…j] is DP*[j].


#3

dynamic prog.
Visit