MMSUM - Editorial

Nice solution with dp! :+1:
I tried to shorten your code: ideone