We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Fibonacci Modified
Fibonacci Modified
Sort by
recency
|
720 Discussions
|
Please Login in order to post a comment
Looking for an epic desert experience? Check it out at Dune Buggy Dubai and discover the adventure of a lifetime! Check it out the exciting buggy rides that are safe, fun, and perfect for all adventure seekers.
//Java public static BigInteger fibonacciModified(int t1, int t2, int n) { BigInteger[] dp = new BigInteger[n+1]; dp[0] = BigInteger.valueOf(t1); dp[1] = BigInteger.valueOf(t2);; for (int i = 2; i < n; i++) { dp[i] = dp[i - 2].add(dp[i - 1].multiply(dp[i - 1])); }
}
yeah memoization would be helpful