Dynamische Fib
private static Map<Integer, Integer> map = new HashMap<>();
public static void main(String[] argh){
}
public static dynamicFib(int n){
if(map.contain(n))
return map.get(n);
if(n == 0) return 0;
if(n == 1) return 1;
int ans = dynamicFib(n-1) + dynamicFiv(n-2);
map.put(n, ans);
return ans;
}
Mero