摘要:
DP.O(n) solution.对于每个bar,找出其左边与右边的最高高度, 可以hold的water =min(max_left, max_right) - height int trap(int A[], int n) { // Start typing your C/C++ solution below // DO NOT write int main() function int maxHeight = 0; vector left(n); for(int i=0;i right(n); for... 阅读全文
posted @ 2013-10-11 23:00
summer_zhou
阅读(146)
评论(0)
推荐(0)
摘要:
int canCompleteCircuit(vector &gas, vector &cost) { // Note: The Solution object is instantiated only once and is reused by each test case. int tank = 0; int total = 0; int n = gas.size(); int index = -1; for(int i=0;i=0?index+1:-1); }... 阅读全文
posted @ 2013-10-11 22:01
summer_zhou
阅读(170)
评论(0)
推荐(0)
浙公网安备 33010602011771号