Skip to content

Commit d3e07b1

Browse files
committed
20190306
1 parent ccd457c commit d3e07b1

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

code/lc138.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* 分类:Hash Table, LinkedList
77
* 思路:一种用HashTable,把源节点和复制的节点对应起来,空间复杂度为O(n)
88
* 把要复制的节点直接连接在该节点之后,操作完以后再分开
9-
* Tips:和139做对比,因为需要每步骤返回值,所以递归的方法在这题更合适
9+
* Tips:因为需要每步骤返回值,所以递归的方法在这题更合适
1010
*/
1111
public class lc138 {
1212
class RandomListNode {

readme.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,18 @@ LeetCode 指南
22
===
33

44
- 语言: Java
5-
- 说明: 每道题在代码头部都添加了我的解题思路和想法,Eg:
5+
- 说明: 每道题在代码头部都添加了我的解题思路和批注,Eg:
66

77

88
/*
9-
* 160. Intersection of Two Linked Lists
10-
* 题意:求两个链表的交叉点
11-
* 难度:Easy
12-
* 分类:LinkedList
13-
* 思路:两种方法:1.找出两个链表的长度差x,长的先走x步; 2.走完一个链表,走另一个链表,两个cur都走了两个链表长度的和步
14-
* Tips:两种方法的本质是一样的其实,都是找到了步数差,都遍历了两遍
9+
* 287. Find the Duplicate Number
10+
* 题意:n+1个数属于[1~n],找出重复的那个数
11+
* 难度:Medium
12+
* 分类:Array, Two Pointers, Binary Search
13+
* 思路:如果nums[i]不在对应位置,则和对应位置交换。如果对应位置上也为该数,说明这个数就是重复的数字。这个方法改变了数组。是错误的。
14+
* 另一种方法,把问题转换成有环链表,找环的起始节点。O(n) O(1) lc142
15+
* 二分查找,每次看一边数字的个数, O(nlog(n)) O(1)
16+
* Tips:剑指offer原题
1517
*/
1618

1719
---

0 commit comments

Comments
 (0)