That’s not happen with python as example, if you want the same with java you have to use the wrappers of Numbers like BigDecimal. ]]>

Fib(76) = 3416454622906707 but this formula will compute 3416454622906716 ]]>

public class Fibonacci {

static double sqrt5 = Math.sqrt(5);

static double phi = (1 +sqrt5)/2;

public static long fibonacci(int n) {

return (long) Math.floor((Math.pow(phi, n)/sqrt5 + 0.5));

}

public static void main(String[] args) {

for(int i=0;i “+fibonacci(i));

}

}

]]>in the tabulated version you can remove the

if (val == 0 || val == 1)

return 1;

ðŸ™‚

]]>I think there’s a typo:

when you solve a DP problem using memoization you do it by maintaining a map if already solved subproblem:

should be

when you solve a DP problem using memoization you do it by maintaining a map OF already solved subproblem:

BTW, very interesting article.

]]>