摘要: 最初的想法,将输入乘以n-1次,时间复杂度为O(n),结果运行结果超时 1 public class Solution { 2 public double pow(double x, int n) { 3 double result = x; 4 double tmp = 1/x; 5 if(n == 0) 6 return 1; 7 8 if(n > 0){ 9 for(int i = 1; i < n; i++)10 re... 阅读全文
posted @ 2013-03-13 11:39 feiling 阅读(258) 评论(0) 推荐(0) 编辑