dynamicprogramming divideandconquer