Amazon Interview Question

String manipulation and DP problems.