上一页 1 ··· 56 57 58 59 60 61 62 63 64 ··· 67 下一页

2018年4月1日

024 Swap Nodes in Pairs 交换相邻结点

摘要: 给定一个链表,对每两个相邻的结点作交换并返回头节点。例如:给定 1->2->3->4,你应该返回 2->1->4->3。你的算法应该只使用额外的常数空间。不要修改列表中的值,只有节点本身可以​​更改。 详见:https://leetcode.com/problems/swap-nodes-in-pa 阅读全文

posted @ 2018-04-01 16:41 lina2014 阅读(115) 评论(0) 推荐(0) 编辑

023 Merge k Sorted Lists 合并K个有序链表

摘要: 合并K个有序链表,并且作为一个有序链表的形式返回。分析并描述它的复杂度。 详见:https://leetcode.com/problems/merge-k-sorted-lists/description/ 实现语言:Java 参考:https://www.cnblogs.com/grandyang 阅读全文

posted @ 2018-04-01 16:33 lina2014 阅读(178) 评论(0) 推荐(0) 编辑

022 Generate Parentheses 生成括号

摘要: 给 n 对括号,写一个函数生成所有合适的括号组合。比如,给定 n = 3,一个结果为:[ "((()))", "(()())", "(())()", "()(())", "()()()"]详见:https://leetcode.com/problems/generate-parentheses/de 阅读全文

posted @ 2018-04-01 16:09 lina2014 阅读(141) 评论(0) 推荐(0) 编辑

021 Merge Two Sorted Lists 合并两个有序链表

摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:I 阅读全文

posted @ 2018-04-01 15:18 lina2014 阅读(122) 评论(0) 推荐(0) 编辑

020 Valid Parentheses 有效的括号

摘要: 给定一个只包括 '(',')','{','}','[',']' 的字符串,判断字符串是否有效。括号必须以正确的顺序关闭,"()" 和 "()[]{}" 是有效的但是 "(]" 和 "([)]" 不是。详见:https://leetcode.com/problems/valid-parentheses 阅读全文

posted @ 2018-04-01 00:15 lina2014 阅读(139) 评论(0) 推荐(0) 编辑

019 Remove Nth Node From End of List 删除链表的倒数第N个节点

摘要: 给定一个链表,删除链表的倒数第 n 个节点并返回头结点。例如,给定一个链表: 1->2->3->4->5, 并且 n = 2.当删除了倒数第二个节点后链表变成了 1->2->3->5.详见:https://leetcode.com/problems/remove-nth-node-from-end- 阅读全文

posted @ 2018-04-01 00:05 lina2014 阅读(121) 评论(0) 推荐(0) 编辑

2018年3月31日

018 4Sum 四个数的和

摘要: 给定一个含有 n 个整数的数组 S,数列 S 中是否存在元素 a,b,c 和 d 使 a + b + c + d = target ?请在数组中找出所有满足各元素相加等于特定值的不重复组合。注意:解决方案集不能包含重复的四元组合。例如,给定数组 S = [1, 0, -1, 0, -2, 2],并且 阅读全文

posted @ 2018-03-31 23:48 lina2014 阅读(121) 评论(0) 推荐(0) 编辑

017 Letter Combinations of a Phone Number 电话号码的字母组合

摘要: 给定一个数字字符串,返回数字所有可能表示的字母组合。 输入:数字字符串 "23"输出:["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]. 详见:https://leetcode.com/problems/letter-combination 阅读全文

posted @ 2018-03-31 22:20 lina2014 阅读(142) 评论(0) 推荐(0) 编辑

014 Longest Common Prefix 查找字符串数组中最长的公共前缀字符串

摘要: 编写一个函数来查找字符串数组中最长的公共前缀字符串。 详见:https://leetcode.com/problems/longest-common-prefix/description/ 实现语言:Java 参考:https://www.cnblogs.com/grandyang/p/460692 阅读全文

posted @ 2018-03-31 22:16 lina2014 阅读(189) 评论(0) 推荐(0) 编辑

013 Roman to Integer 罗马数字转整数

摘要: 给定一个罗马数字,将其转换成整数。 返回的结果要求在 1 到 3999 的范围内。 详见:https://leetcode.com/problems/roman-to-integer/description/ class Solution { public: int romanToInt(strin 阅读全文

posted @ 2018-03-31 21:34 lina2014 阅读(140) 评论(0) 推荐(0) 编辑

上一页 1 ··· 56 57 58 59 60 61 62 63 64 ··· 67 下一页

导航