Skip to content

Commit 7d346db

Browse files
committed
Added null check.
1 parent 900ecc8 commit 7d346db

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

Chp. 02 - Linked Lists/_2_7_Intersection/Intersection.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
public class Intersection {
1212
public static Integer findMergeNode(Node headA, Node headB) {
13+
if (headA == null || headB == null) {
14+
return null;
15+
}
1316
Node currA = headA;
1417
Node currB = headB;
1518

Chp. 17 - More Problems (Hard)/_17_20_Continuous_Median/ContinuousMedian.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
public class ContinuousMedian {
1212
private static PriorityQueue<Integer> maxHeap = new PriorityQueue<>(Collections.reverseOrder()); // maxHeap contains all SMALL elements
13-
private static PriorityQueue<Integer> minHeap = new PriorityQueue<>(); // minHeap contains all LARGE elements
13+
private static PriorityQueue<Integer> minHeap = new PriorityQueue<>(); // minHeap contains all LARGE elements
1414

1515
public static void addNum(int n) {
1616
if (maxHeap.isEmpty()) {

0 commit comments

Comments
 (0)