Ed

Memoization caches function results to avoid expensive recalculations. It's a key performance pattern, especially for recursive or API-heavy functions.

Your Task:

  • Create a memoize(fn) function
  • It should return a new function that caches results
  • Use the arguments as the cache key
  • If called with the same args, return cached value
  • Track cache hits with a cacheHits counter
TypeScript Solution
Loading...

Submit your code to see test results