LeetCode
z11h
这个作者很懒,什么都没留下…
展开
-
LeetCode 53 Maximum Subarray 最大子序列和
算法思想: new一个新的数列与已知数列长度相同,将新序列的第一个数字置为已知数列的第一个数字,视为第一个数字这个子序列的和,然后从第2个数开始,依次计算该数与前面的子序列的和是否大于等于0,若为true则新数列该位置置为该和,若为false则新数列该位置与旧数列该位置数字相同。 代码如下 int[] num = new int[nums.length]; num[0] =原创 2017-01-15 18:49:25 · 404 阅读 · 0 评论 -
LeetCode 338
338. Counting Bits Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return them as an array.原创 2017-01-12 16:41:41 · 125 阅读 · 0 评论