Share your repls and programming experiences

← Back to all posts
recursive fib func with memoization *ONE LINER* (1 line series)[no4]
rafrafraf (1389)

This is my implementation of the fibonacci function using recursion and memoization in one line!

if you wanna learn how it works and what memoization/recursion is check out this post i made which covers that and more!

I struggled with this one liner mainly because of how memoization requires a global variable, in this case a dict called cache, but it came together in the end.

let me know if you have an idea for what i should attempt to make in one line next :)

JBloves27 (1695)

Wow! Nice job continuing on with the one liner! XD :D

JacobMcPherson1 (189)

I'm in middle school so I don't understand all of these big words

rafrafraf (1389)

@JacobMcPherson1 lmao thats fine this is some high level stuff way beyond middle school! id be surprised if ya did :)