Improve recursive using DP

Using additional data structure to record what we have meet, that is the
basic idea of converting recursive to DP.
But practice still need.