package LeetCode_50 /** * 50. Pow(x, n) * https://leetcode.com/problems/powx-n/description/ * * Implement pow(x, n), which calculates x raised to the ...
分类:
其他好文 时间:
2020-06-04 01:10:44
阅读次数:
68
50. Pow(x, n) https://leetcode-cn.com/problems/powx-n/ 实现 pow(x, n) ,即计算 x 的 n 次幂函数。 说明: -100.0 < x < 100.0 n 是 32 位有符号整数,其数值范围是 [?231, 231 ? 1] 。 解: ...
分类:
其他好文 时间:
2019-08-15 12:56:09
阅读次数:
64
题目链接 : https://leetcode cn.com/problems/powx n/ 题目描述: 实现 "pow( x , n )" ,即计算 x 的 n 次幂函数。 示例: 示例 1: 示例 2: 示例 3: 说明: 100.0 float: if n float: if n float ...
分类:
其他好文 时间:
2019-05-17 16:42:06
阅读次数:
141
https://leetcode.com/problems/powx-n/ Implement pow(x, n), which calculates x raised to the power n (xn). Example 1: Example 2: Example 3: Note: -100. ...
分类:
其他好文 时间:
2018-11-15 22:40:35
阅读次数:
156
题目描述 Implement pow(x, n). AC: class Solution { public: double pow(double x, int n) { if(x == 0 && n == 0) return 1; if(x == 0) return 0; if(n == 0) re ...
分类:
其他好文 时间:
2018-09-15 23:50:18
阅读次数:
366
https://leetcode.com/problems/powx-n/description/ ...
分类:
其他好文 时间:
2018-05-19 14:01:48
阅读次数:
149
Implement pow(x, n). //考虑一下情况:1.n<0 ;用暴力法会超时,所以这里用递归 ...
分类:
其他好文 时间:
2017-03-08 18:53:21
阅读次数:
119
题目链接:https://leetcode.com/problems/powx-n/
题目:
Implement pow(x, n).
思路:
easy。上课例题= =
算法:
public double myPow(double x, int n) {
if(n<0)
return 1.0/(myPow2(x,-n));
el...
分类:
其他好文 时间:
2016-05-27 12:27:43
阅读次数:
180
题目来源https://leetcode.com/problems/powx-n/Implement pow(x,n).题意分析Input: x,nOutput:pow(x,n)Conditions:满足一定的内存需求,算法复杂度低一些题目思路刚开始以为直接乘就好了,但是爆内存了,仔细看发现其实可以...
分类:
编程语言 时间:
2015-12-23 22:48:06
阅读次数:
318
题目来源: https://leetcode.com/problems/powx-n/题意分析: 实现一个整型的幂运算。题目思路: 幂运算可以利用二分的方法来做。也就是x^n = x ^ (n /2) * x ^(n / 2) (n %2 == 0)或者x^n = x ^ (n /2) * x...
分类:
编程语言 时间:
2015-11-10 19:30:59
阅读次数:
263