You are viewing a single comment's thread. Return to all comments →
I did it using a simple loop and I don't even know what DP is. Could you please show me what a solution using DP looks like?
function main() { let [a, b, n] = input.split(' ').map(Number); a = new BigNumber(a); b = new BigNumber(b); for (let i = 3; i <= n; i++) { var c = next(a, b); a = b, b = c; } process.stdout.write(c.toFixed()); }
Seems like cookies are disabled on this browser, please enable them to open this website
Fibonacci Modified
You are viewing a single comment's thread. Return to all comments →
I did it using a simple loop and I don't even know what DP is. Could you please show me what a solution using DP looks like?