{"ScriptPreparationCode":null,"TestCases":[{"Name":"My Pow","Code":"\r\nfunction myPow(x, n) {\r\n function calc_power(x, n) {\r\n if (x === 0) {\r\n return 0;\r\n }\r\n if (n === 0) {\r\n return 1;\r\n }\r\n\r\n let res = calc_power(x, Math.floor(n / 2));\r\n res = res * res;\r\n\r\n if (n % 2 === 1) {\r\n return res * x;\r\n }\r\n\r\n return res;\r\n }\r\n\r\n let ans = calc_power(x, Math.abs(n));\r\n\r\n if (n \u003E= 0) {\r\n return ans;\r\n }\r\n\r\n return 1 / ans;\r\n}\r\n\r\n\r\nmyPow(2, 3)\r\nmyPow(5, 0)\r\nmyPow(7, 1)\r\nmyPow(-3, 4)\r\nmyPow(-2, 3)\r\nmyPow(0, 5)\r\nmyPow(0, 0)\r\nmyPow(0, -2)\r\nmyPow(1, 100)\r\nmyPow(10, 2)\r\nmyPow(0.5, 10)\r\nmyPow(-2, 10)\r\nmyPow(2, -3)\r\nmyPow(1.5, 2)\r\nmyPow(-3, -2)\r\nmyPow(99, 100000000000)","IsDeferred":false},{"Name":"Math.Pow","Code":"Math.pow(2, 3)\r\nMath.pow(5, 0)\r\nMath.pow(7, 1)\r\nMath.pow(-3, 4)\r\nMath.pow(-2, 3)\r\nMath.pow(0, 5)\r\nMath.pow(0, 0)\r\nMath.pow(1, 100)\r\nMath.pow(10, 2)\r\nMath.pow(0.5, 10)\r\nMath.pow(-2, 10)\r\nMath.pow(2, -3)\r\nMath.pow(1.5, 2)\r\nMath.pow(-3, -2)\r\nMath.pow(99, 100000000000)\r\n\r\n\r\n","IsDeferred":false}]}