You may be subject dfs can think about if you can use dynamic programming to solve, can save a lot of open stacks and stacks of cost recovery;
If you can not think about if you can use that memory search, this can save a lot of cost repetition sub-problem calculation;
About section DP, the issue of string or a sequence interval DP is most problems; but may involve how to define the same problem substring;