摘要: int a,b;a=b=1;int c;if(n==1||n==0)return 1;elsewhile(--n>0){ c=a+b; a=b; b=c;}return c;}}; 阅读全文
posted @ 2017-03-08 20:01 hu199758 阅读(71) 评论(0) 推荐(0) 编辑
摘要: int ret = 0; if(prices.size()<2) return ret; int lowest = prices[0]; for(int i=1;i<prices.size();i++) { int cur = prices[i]; ret = max(ret,cur-lowest) 阅读全文
posted @ 2017-03-08 20:01 hu199758 阅读(119) 评论(0) 推荐(0) 编辑
摘要: if(nums.empty()) { return 0; }//if int n = nums.size(),k=0; for(int i=1;i<n;++i) { if(nums[i] != nums[k]) { nums[++k] = nums[i]; }//if }//for nums.res 阅读全文
posted @ 2017-03-08 20:00 hu199758 阅读(265) 评论(0) 推荐(0) 编辑