Uber interview question

DP problems with strings