Question
Given the heads of two singly linked-lists headA
and headB
, return the node at which the two lists intersect. If the two linked lists have no intersection at all, return null
.
https://leetcode.com/problems/intersection-of-two-linked-lists/
- Solution1
1 | public class Solution { |
Complexity:
Time complexity: O(n)
Space complexity: O(1)