摘要:
Maximum Subarray2013.12.17 14:21Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray[4,−1,2,1]has the largest sum =6.click to show more practice.More practice:If you have fi 阅读全文
posted @ 2013-12-17 15:18
zhuli19901106
阅读(215)
评论(0)
推荐(0)
摘要:
Pow(x, n)2013.12.17 13:56Implement pow(x,n).Solution: Problem description is simple, so is the solution: divide and conquer. To calculae x^n, you'll need to know x^(n / 2) first. Later, let's deal with boundary values: 1. n = 0 2. n > 0 3. n 0 Think of any possible combinations and use .. 阅读全文
posted @ 2013-12-17 14:07
zhuli19901106
阅读(234)
评论(0)
推荐(0)


浙公网安备 33010602011771号