New solution, but unfortunately I needed big help on this one. Could not figure out the pattern for DP.