码迷,mamicode.com
首页 >  
搜索关键字:solution upgrade    ( 13024个结果
LeetCode Length of Last Word
class Solution {public: int lengthOfLastWord(const char *s) { if (s == NULL) return 0; int mlen = 0, len = 0; bool inword = fa...
分类:其他好文   时间:2014-06-29 14:13:37    阅读次数:229
LeetCode Permutations II
class Solution { public: vector > permuteUnique(vector &num) { vector > result; if (num.size() path; dfs(n...
分类:其他好文   时间:2014-06-29 14:09:34    阅读次数:220
Leetcode Add Two Numbers
class Solution {public: ListNode *addTwoNumbers(ListNode *l1, ListNode *l2) { ListNode* p = l1; ListNode* q = l2; ListNode* re...
分类:其他好文   时间:2014-06-07 03:50:49    阅读次数:218
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...
分类:其他好文   时间:2014-05-30 08:39:11    阅读次数:270
[leetcode]Subsets @ Python
原题地址:https://oj.leetcode.com/problems/subsets/题意:枚举所有子集。解题思路:碰到这种问题,一律dfs。代码:class Solution: # @param S, a list of integer # @return a list of l...
分类:编程语言   时间:2014-05-30 04:31:09    阅读次数:1243
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...
分类:其他好文   时间:2014-05-30 02:54:28    阅读次数:231
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; ...
分类:其他好文   时间:2014-05-30 02:46:12    阅读次数:318
Leetcode: Best Time to Buy and Sell Stock II
一次过,思路是:最大收益可以由所有上升序列差价叠加中获得 1 public class Solution { 2 public int maxProfit(int[] prices) { 3 int profit = 0; 4 if (prices.lengt...
分类:其他好文   时间:2014-05-29 20:43:33    阅读次数:254
leetcode -- 4sum
class Solution {public: vector > ret; vector subret;public: vector > fourSum(vector &num, int target) { sort(num.begin(),num.end()); ...
分类:其他好文   时间:2014-05-29 09:31:13    阅读次数:288
LeetCode Spiral Matrix II
class Solution { public: vector > generateMatrix(int n) { vector > matrix; if (n (n, 0)); }...
分类:其他好文   时间:2014-05-28 09:42:14    阅读次数:233
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!