https://trstringer.com/optimization-with-memoization/
Optimize Redundant Operations with Memoization - Thomas Stringer