摘要: Implement pow(x,n).解题思路:求浮点数的幂次方,注意可能为负数次幂;可以使用二分搜索的思想,当n为偶数时,x^n = x^(n/2) * x^(n/2),因此只需要求得一半的幂次方,将结果平方,就得到所求结果。解题步骤:1、递归最底层,n == 0 时,返回1;2、求出t = po... 阅读全文
posted @ 2015-08-30 16:11 胡潇 阅读(475) 评论(0) 推荐(0) 编辑
摘要: Given an array of strings, group anagrams together.For example, given:["eat", "tea", "tan", "ate", "nat", "bat"],Return:[ ["ate", "eat","tea"], ["na... 阅读全文
posted @ 2015-08-30 15:43 胡潇 阅读(598) 评论(0) 推荐(0) 编辑