### leetcode解题笔记

1 已关注
40篇博文

题目：Given a linked list, determine if it has a cycle in it. 解析：可以声明两个指针，一个快指针，一个慢指针，如果链表中存在环，则两个指针肯定...

2015-06-04 19:54
543
• #### 【leetcode每日一题】NO19.Remove Nth Node From End of List

题目：Given a linked list, remove the nth node from the end of list and return its head.即给定一个链表，删除倒数第n个...

2015-08-07 20:53
520
• #### 【leetcode每日一题】NO83.Remove Duplicates from Sorted List

题目：给定一个有序链表，删除重复值的节点，使得每个值只出现一次。 解析：链表是有序的，我们可以声明两个指针，一个指向当前节点，一个指向下一个节点，判断这两个节点指向的值是否相等，如果相等，则删掉节点...

2015-08-11 22:01
501
• #### 【leetcode每日一题】NO21.Merge Two Sorted Lists

题目：Merge two sorted linked lists and return it as a new list. The new list should be made by splicin...

2015-08-12 09:15
440

题目：Reverse a singly linked list.即单链表反序。 解析：链表反序是很常见的题目，不过多解释了，直接上代码。 /** * Definition for singly-...

2015-08-13 10:13
588
• #### 【leetcode每日一题】NO142.Linked List Cycle II

题目：Given a linked list, return the node where the cycle begins. If there is no cycle, return null 解析...

2015-08-14 09:02
537
• #### 【leetcode每日一题】NO160.Intersection of Two Linked Lists

题目：Write a program to find the node at which the intersection of two singly linked lists begins. For...

2015-08-15 09:08
397
• #### 【leetcode每日一题】NO109.Convert Sorted List to Binary Search Tree

题目：Given a singly linked list where elements are sorted in ascending order, convert it to a height b...

2015-08-15 22:34
410
• #### 【leetcode每日一题】NO86.Partition List

题目：Given a linked list and a value x, partition it such that all nodes less than x come before nodes...

2015-08-16 09:33
393
• #### 【leetcode每日一题】NO92.Reverse Linked List II

题目：Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Give...

2015-08-17 09:31
464
• #### 【leetcode每日一题】NO257.Binary Tree Paths

题目：Given a binary tree, return all root-to-leaf paths. For example, given the following binary tr...

2015-08-25 21:38
486
• #### 【leetcode每日一题】149.Max Points on a line

题目：Given n points on a 2D plane, find the maximum number of points that lie on the same straight lin...

2015-08-28 15:11
776
• #### 【leetcode每日一题】24.Swap Nodes in Pairs

题目： Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->...

2015-08-31 22:10
466
• #### 【leetcode每日一题】203.Remove Linked List Elements

题目： Remove all elements from a linked list of integers that have value val. Example Given: ...

2015-08-31 22:19
513
• #### 【leetcode每日一题】25.Reverse Nodes in k-Group

题目： Given a linked list, reverse the nodes of a linked list k at a time and return its modifi...

2015-09-01 09:35
867
• #### 【leetcode每日一题】82.Remove Duplicates from Sorted List II

题目： Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only dist...

2015-09-01 10:49
1277
• #### 【leetcode每日一题】148.sort List

题目：Sort a linked list in O(n log n) time using constant space complexity. 解析：题目要求是对链表进行排序，但是复杂度不能...

2015-09-01 11:30
738

题目： Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n...

2015-09-01 12:32
449
• #### 【leetcode每日一题】61.Rotate List

题目： Given a list, rotate the list to the right by k places, where k is non-negative. For example: ...

2015-09-01 12:52
381
• #### 【leetcode每日一题】Reorder List

题目： Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must...

2015-09-01 14:37
784