Skip to content

Commit 759c0a3

Browse files
authored
Update readme.md
1 parent 96d2da8 commit 759c0a3

File tree

1 file changed

+6
-2
lines changed
  • src/main/java/g0101_0200/s0160_intersection_of_two_linked_lists

1 file changed

+6
-2
lines changed

src/main/java/g0101_0200/s0160_intersection_of_two_linked_lists/readme.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ The judge will then create the linked structure based on these inputs and pass t
3232

3333
**Output:** Intersected at '8'
3434

35-
**Explanation:** The intersected node's value is 8 (note that this must not be 0 if the two lists intersect). From the head of A, it reads as [4,1,8,4,5]. From the head of B, it reads as [5,6,1,8,4,5]. There are 2 nodes before the intersected node in A; There are 3 nodes before the intersected node in B. - Note that the intersected node's value is not 1 because the nodes with value 1 in A and B (2<sup>nd</sup> node in A and 3<sup>rd</sup> node in B) are different node references. In other words, they point to two different locations in memory, while the nodes with value 8 in A and B (3<sup>rd</sup> node in A and 4<sup>th</sup> node in B) point to the same location in memory.
35+
**Explanation:** The intersected node's value is 8 (note that this must not be 0 if the two lists intersect).
36+
37+
From the head of A, it reads as [4,1,8,4,5]. From the head of B, it reads as [5,6,1,8,4,5]. There are 2 nodes before the intersected node in A; There are 3 nodes before the intersected node in B.
38+
39+
- Note that the intersected node's value is not 1 because the nodes with value 1 in A and B (2<sup>nd</sup> node in A and 3<sup>rd</sup> node in B) are different node references. In other words, they point to two different locations in memory, while the nodes with value 8 in A and B (3<sup>rd</sup> node in A and 4<sup>th</sup> node in B) point to the same location in memory.
3640

3741
**Example 2:**
3842

@@ -65,4 +69,4 @@ The judge will then create the linked structure based on these inputs and pass t
6569
* `intersectVal` is `0` if `listA` and `listB` do not intersect.
6670
* `intersectVal == listA[skipA] == listB[skipB]` if `listA` and `listB` intersect.
6771

68-
**Follow up:** Could you write a solution that runs in `O(m + n)` time and use only `O(1)` memory?
72+
**Follow up:** Could you write a solution that runs in `O(m + n)` time and use only `O(1)` memory?

0 commit comments

Comments
 (0)