LinkedIn - Senior Front end software engineer

LinkedIn - Senior Front end software engineer

LinkedIn - Senior Front end software engineer - Tech screening

Description Template:
Level: L4
Education:Masters
Years of Experience: 8
Questions Asked: 1

Description:
Education: Masters
Years of Experience (YOE): 7
Questions Asked:

A memoize function is a higher-order function that takes in a function and returns a memoized version of it. The memoized function caches the results of expensive function calls and returns the cached result when it receives the same inputs again. This can significantly improve the performance of functions that involve complex processing / significant latency and are called with the same arguments repeatedly.

Implement a function memoize(func) that takes in a function parameter func and returns a memoized version of the function. You may assume that func only accepts strings or numbers as arguments.