11 2016 档案
【LeetCode】21. 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. 思路:比 阅读全文
posted @ 2016-11-09 22:32 一只笨笨鸟 编辑
【LeetCode】20. Valid Parentheses
摘要:题目: 思路:用Stack基本操作完成。 要检测输入字符是否满足这个条件,一个非常合适的数据结构是stack,后进先出的特征正好满足检测的需求。在检测的时候,每次检查一个字符,如果是左括号,就入栈,如果是右括号,并且右括号和当前栈顶符号是左右配对的,那么就弹出栈顶并且进行下一次检测,如果不满足上面两 阅读全文
posted @ 2016-11-08 21:47 一只笨笨鸟 编辑
【LeetCode】19. Remove Nth Node From End of List
摘要:题目: 思路:如果链表为空或者n小于1,直接返回即可,否则,让链表从头走到尾,每移动一步,让n减1。 1.链表1->2->3,n=4,不存在倒数第四个节点,返回整个链表 扫过的节点依次:1-2-3 n值得变化:3-2-1 2.链表1->2->3,n=3 扫过的节点依次:1-2-3 n值得变化:2-1 阅读全文
posted @ 2016-11-07 22:01 一只笨笨鸟 编辑
【LeetCode】18. 4Sum
摘要:题目: 思路:这题和15题很像,外层再加一个循环稍作修改即可 阅读全文
posted @ 2016-11-04 21:06 一只笨笨鸟 编辑
【LeetCode】17. Letter Combinations of a Phone Number
摘要:题目: 思路:设置两个List,一个存储当前层,一个存储最终层 阅读全文
posted @ 2016-11-03 21:51 一只笨笨鸟 编辑
【LeetCode】16. 3Sum Closest
摘要:题目: Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integ 阅读全文
posted @ 2016-11-03 15:39 一只笨笨鸟 编辑
【LeetCode】15. 3Sum 三个数和为0
摘要:题目: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum 阅读全文
posted @ 2016-11-02 15:21 一只笨笨鸟 编辑


点击右上角即可分享
微信分享提示