Leetcode||50. Pow(x, n)
来源:互联网 发布:linux 进程网络流量 编辑:程序博客网 时间:2024/06/08 00:15
Implement pow(x, n).
实现幂的算法,需要考虑到正负数,我是用递归
class Solution(object): def myPow(self, x, n): """ :type x: float :type n: int :rtype: float """ if n==0: return 1 if n<0: return 1.0/self.myPow(x,-n) if n%2==1: return x*self.myPow(x*x,n/2) else: return self.myPow(x*x,n/2)
阅读全文
0 0
- [LeetCode]50.Pow(x, n)
- LeetCode --- 50. Pow(x, n)
- [Leetcode] 50. Pow(x, n)
- [leetcode] 50.Pow(x, n)
- LeetCode 50. Pow(x, n)
- 50. Pow(x, n) LeetCode
- [leetcode] 50. Pow(x, n)
- Leetcode 50. Pow(x, n)
- [LeetCode]50. Pow(x, n)
- LeetCode *** 50. Pow(x, n)
- LeetCode 50. Pow(x, n)
- LeetCode 50. Pow(x, n)
- 【LeetCode】50. Pow(x, n)
- [leetcode]50. Pow(x, n)
- LeetCode-50.Pow(x, n)
- LeetCode - 50. Pow(x, n)
- [LeetCode] 50. Pow(x, n)
- LeetCode 50. Pow(x, n)
- jsp常用动作列表
- 进程的基本概念及操作
- openlayers矢量圆形获取圆心和半径
- I
- Spark性能优化:开发调优篇
- Leetcode||50. Pow(x, n)
- AsyncTask的基础使用
- SMAA算法详解
- IntelliJ IDEA Tomcat配置 详解
- K
- apprest css样式
- SPI设备端驱动编写----基于linux4.9 driver核心层
- matplotlib 绘图可视化
- background url为空