码迷,mamicode.com
首页 >  
搜索关键字:leetcode 19    ( 34993个结果
[leetcode]_Add Two Numbers
题目:两个链表存储数字,然后求和,和值存储在一个链表中。代码: 1 public ListNode addTwoNumbers(ListNode l1, ListNode l2) { 2 ListNode head = new ListNode(0); 3 ListN...
分类:其他好文   时间:2014-06-29 15:15:57    阅读次数:240
LeetCode:Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your ...
分类:其他好文   时间:2014-06-29 14:39:10    阅读次数:268
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 Letter Combinations of a Phone Number
const char* lookup[] = {" ", "", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxy...
分类:其他好文   时间:2014-06-07 05:04:11    阅读次数:192
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 -- 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--Substring with Concatenation of All Words
You are given a string,S, and a list of words,L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatenati...
分类:其他好文   时间:2014-05-29 09:09:35    阅读次数:222
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
迷上了代码!