2014年5月28日

leetcode -- Best Time to Buy and Sell Stock II

摘要: class Solution {public: int maxProfit(vector &prices) { if(prices.size() == 0) return 0; vector f(prices.size()); f[0] = 0; ... 阅读全文

posted @ 2014-05-28 21:18 berkeleysong 阅读(141) 评论(0) 推荐(0)

leetcode -- Best Time to Buy and Sell Stock

摘要: class Solution {public: int maxProfit(vector &prices) { if(prices.size() == 0) return 0; vector f1(prices.size()); int minV = pri... 阅读全文

posted @ 2014-05-28 21:02 berkeleysong 阅读(104) 评论(0) 推荐(0)

Add Two Numbers

摘要: class Solution {public: ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { if(NULL == l1) return l2; if(NULL == l2) return l1; ... 阅读全文

posted @ 2014-05-28 20:21 berkeleysong 阅读(176) 评论(0) 推荐(0)

leetcode -- Add Binary

摘要: Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".class Solution {public: string addBinary(str... 阅读全文

posted @ 2014-05-28 12:15 berkeleysong 阅读(145) 评论(0) 推荐(0)

leetcode -- 4sum

摘要: class Solution {public: vector > ret; vector subret;public: vector > fourSum(vector &num, int target) { sort(num.begin(),num.end()); ... 阅读全文

posted @ 2014-05-28 11:12 berkeleysong 阅读(139) 评论(0) 推荐(0)

leecode -- 3sum Closet

摘要: Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文

posted @ 2014-05-28 10:32 berkeleysong 阅读(206) 评论(0) 推荐(0)

导航