2014年9月7日

Pow(x, n)

摘要: Implement pow(x, n). 这题主要考察分治法,这样效率就可达到O(logn) 需要注意的是:n>0时 n为偶数时 xn = xn/2 * xn/2,n为奇数时 xn = x(n-1)/2 * x(n-1)/2 * x n=0时 ,xn = 1 n<0时 xn = 1 / x-n 代码 阅读全文

posted @ 2014-09-07 22:27 bug睡的略爽 阅读(153) 评论(0) 推荐(0) 编辑

Implement strStr()

摘要: Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if needle is not part of haystack. 方法一:暴力破解,O(mn),超时,写了这段 阅读全文

posted @ 2014-09-07 21:32 bug睡的略爽 阅读(163) 评论(0) 推荐(0) 编辑

导航