diff options
Diffstat (limited to 'intersection_2_linked_list.cpp')
-rw-r--r-- | intersection_2_linked_list.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/intersection_2_linked_list.cpp b/intersection_2_linked_list.cpp deleted file mode 100644 index 7477734..0000000 --- a/intersection_2_linked_list.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) { - ListNode *p1 = headA; - ListNode *p2 = headB; - if (p1 == NULL || p2 == NULL) - return NULL; - while (p1 != NULL && p2 != NULL && p1 != p2) { - p1 = p1->next; - p2 = p2->next; - if (p1 == p2) - return p1; - if (p1 == NULL) - p1 = headB; - if (p2 == NULL) - p2 = headA; - } - return p1; - } -}; - -int main() {} |