We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fbc63e commit 849aeb1Copy full SHA for 849aeb1
160-intersection-of-two-linked-lists.js
@@ -1,3 +1,27 @@
1
+/**
2
+ * Definition for singly-linked list.
3
+ * function ListNode(val) {
4
+ * this.val = val;
5
+ * this.next = null;
6
+ * }
7
+ */
8
+
9
10
+ * @param {ListNode} headA
11
+ * @param {ListNode} headB
12
+ * @return {ListNode}
13
14
+const getIntersectionNode = function(headA, headB) {
15
+ let a = headA, b = headB
16
+ while(a !== b) {
17
+ a = a == null ? headB : a.next
18
+ b = b == null ? headA : b.next
19
+ }
20
+ return a
21
+};
22
23
+// another
24
25
/**
26
* Definition for singly-linked list.
27
* function ListNode(val) {
0 commit comments