{"ScriptPreparationCode":"function recfac(n){\r\n if(n\u003C0)return;\r\n return !n||n*recfac(n-1);\r\n}\r\nfunction itefac(n){\r\n if(n\u003C0)return;\r\n let res=1;\r\n while(n\u003E1)(res*=n,n-=1);\r\n return res;\r\n}\r\nfunction arrfac(n){\r\n if(n\u003C0)return;\r\n return Array(n).fill().map((e,i)=\u003Ei\u002B1).reduce((a,b)=\u003Ea*b);\r\n}\r\nlet mem=[];\r\nfunction memfac(n){\r\n if(n\u003C0)return;\r\n return n\u003C2?1:mem[n]||(mem[n]=n*memfac(n-1));\r\n}","TestCases":[{"Name":"Recursive","Code":"for(let i=1;i\u003C71;i\u002B\u002B)recfac(i);","IsDeferred":false},{"Name":"Iterative","Code":"for(let i=1;i\u003C71;i\u002B\u002B)itefac(i);","IsDeferred":false},{"Name":"Array Reduction","Code":"for(let i=1;i\u003C71;i\u002B\u002B)arrfac(i);","IsDeferred":false},{"Name":"Memoization","Code":"for(let i=1;i\u003C71;i\u002B\u002B)memfac(i);","IsDeferred":false}]}