{"ScriptPreparationCode":null,"TestCases":[{"Name":"Fib Base","Code":"const fibonacci = (n) =\u003E {\r\n\tif (n \u003C= 1) return 1;\r\n\treturn fibonacci(n - 1) \u002B fibonacci(n - 2);\r\n};\r\n\r\nfibonacci(20);\r\n","IsDeferred":false},{"Name":"Fib memoized 1","Code":"const memoize = function(func) {\r\n\tvar stringifyJson = JSON.stringify,\r\n\t\tcache = {};\r\n\r\n\tvar cachedfun = function() {\r\n\t\tvar hash = stringifyJson(arguments);\r\n\t\treturn hash in cache ? cache[hash] : (cache[hash] = func.apply(this, arguments));\r\n\t};\r\n\r\n\tcachedfun.__cache = function() {\r\n\t\tcache.remove ||\r\n\t\t\t(cache.remove = function() {\r\n\t\t\t\tvar hash = stringifyJson(arguments);\r\n\t\t\t\treturn delete cache[hash];\r\n\t\t\t});\r\n\t\treturn cache;\r\n\t}.call(this);\r\n\r\n\treturn cachedfun;\r\n};\r\n\r\nconst fibonacci = memoize((n) =\u003E {\r\n\tif (n \u003C= 1) return 1;\r\n\treturn fibonacci(n - 1) \u002B fibonacci(n - 2);\r\n});\r\n\r\nfibonacci(20);\r\n","IsDeferred":false},{"Name":"Fib memoized Tommy","Code":"const memoize = function(func) {\r\n\tconst cache= {}\r\n return (...args) =\u003E {\r\n const n = args[0]\r\n if (n in cache) {\r\n return cache[n];\r\n } else {\r\n const result = func(n)\r\n cache[n] = result\r\n return result\r\n }\r\n }\r\n};\r\n\r\nconst fibonacci = memoize((n) =\u003E {\r\n\tif (n \u003C= 1) return 1;\r\n\treturn fibonacci(n - 1) \u002B fibonacci(n - 2);\r\n});\r\n\r\nfibonacci(20);\r\n","IsDeferred":false}]}