I need some help with a program I\'m writing for my Programming II class at universtiy. The question asks that one calculates the Fibonacci sequence using recursion. One mus
public static int fib(int n, Map map){ if(n ==0){ return 0; } if(n ==1){ return 1; } if(map.containsKey(n)){ return map.get(n); } Integer fibForN = fib(n-1,map) + fib(n-2,map); map.put(n, fibForN); return fibForN; }
Similar to most solutions above but using a Map instead.