2014年12月19日

摘要: Fast Power 原题链接:http://lintcode.com/en/problem/fast-power/#Calculate the an% b where a, b and n are all 32bit integers.ExampleFor 231 % 3 = 2For 10010... 阅读全文
posted @ 2014-12-19 22:08 Yu's Garden 阅读(5024) 评论(0) 推荐(1) 编辑
摘要: Pow(x, n) Implement pow(x, n).SOLUTION 1:使用二分法。1. 负数的情况,使用以下的公式转化为求正数power,另外,考虑到MIN_VALUE可能会造成越界的情况,我们先将负数+1:X^(-n) = X^(n + 1) * XX^n = 1/(x^(-n))2.... 阅读全文
posted @ 2014-12-19 20:29 Yu's Garden 阅读(2321) 评论(0) 推荐(0) 编辑
摘要: Minimum Subarray原题链接: http://lintcode.com/zh-cn/problem/minimum-subarray/#Given an array of integers, find the subarray with smallest sum.Return the s... 阅读全文
posted @ 2014-12-19 18:26 Yu's Garden 阅读(641) 评论(0) 推荐(0) 编辑
摘要: Subarray Sum 原题链接:http://lintcode.com/zh-cn/problem/subarray-sum/#Given an integer array, find a subarray where the sum of numbers is zero. Your code ... 阅读全文
posted @ 2014-12-19 18:01 Yu's Garden 阅读(3698) 评论(1) 推荐(0) 编辑

导航