![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
面试题
DDUp_
积的取余等于取余的积的取余
展开
-
【做题技巧】输出多个数时最后一个数后空格的处理
当需要输出一系列的数(或字符串等)原创 2014-08-07 10:30:52 · 4919 阅读 · 0 评论 -
子数组最大和
设sum[i]为以第i个元素结尾且和最大的连续子数组。假设对于元素i,所有以它前面的元素结尾的子数组的长度都已经求得,那么以第i个元素结尾且和最大的连续子数组实际上,要么是以第i-1个元素结尾且和最大的连续子数组加上这个元素,要么是只包含第i个元素,即sum[i] = max(sum[i-1] + a[i], a[i])。可以通过判断sum[i-1] + a[i]是否大于a[i]来做选择,而这原创 2014-08-08 14:04:44 · 355 阅读 · 0 评论 -
[leetcode] Gas Station
题目描述: There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station原创 2015-01-14 16:52:26 · 386 阅读 · 0 评论