Fibonacci dynamic programming for overlapping subproblems