{"ScriptPreparationCode":null,"TestCases":[{"Name":"Memoizer ","Code":"function memoizer(func) {\r\n const cache = {};\r\n return function() {\r\n const key = JSON.stringify(arguments);\r\n\r\n if (cache[key] !== undefined) {\r\n return cache[key];\r\n }\r\n const result = func(...arguments);\r\n cache[key] = result;\r\n return result;\r\n };\r\n}\r\n\r\nconst fibonacci = n =\u003E {\r\n if (n \u003C= 1) return 1;\r\n return fibonacci(n - 1) \u002B fibonacci(n - 2);\r\n};\r\n\r\nconst cachedFibonacci = memoizer(fibonacci);\r\n\r\nconst getCachedFibonacci = (limit = 1) =\u003E {\r\n const arr = [];\r\n for (let i = 0; i \u003C= limit; i\u002B\u002B) {\r\n arr.push(cachedFibonacci(i));\r\n }\r\n return arr;\r\n};\r\n\r\ngetCachedFibonacci(30)","IsDeferred":false},{"Name":"No Memoizer","Code":"const fibonacci = n =\u003E {\r\n if (n \u003C= 1) return 1;\r\n return fibonacci(n - 1) \u002B fibonacci(n - 2);\r\n};\r\n\r\nconst getFibonacci = (limit = 1) =\u003E {\r\n const arr = [];\r\n for (let i = 0; i \u003C= limit; i\u002B\u002B) {\r\n arr.push(fibonacci(i));\r\n }\r\n return arr;\r\n};\r\ngetFibonacci(30)","IsDeferred":false}]}