message: Update intersection-of-two-linked-lists.cpp
diff: @@ -13,32 +13,10 @@ class Solution {
  public:
  ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
  ListNode *curA = headA, *curB = headB;
  - ListNode *begin = nullptr, *tailA = nullptr, *tailB = nullptr;
  - while (curA && curB) {
  - if (curA == curB) {
  - begin = curA;
  - break;
  + while (curA != curB) {
  + curA = curA ? curA->next : headB;
  + curB = curB ? curB->next : headA;
  }
  -
  - if (curA->next) {
  - curA = curA->next;
  - } else if (!tailA) {
  - tailA = curA;
  - curA = headB;
  - } else {
  - break;
  - }
  -
  - if (curB->next) {
  - curB = curB->next;
  - } else if (!tailB) {
  - tailB = curB;
  - curB = headA;
  - } else {
  - break;
  - }
  - }
  -
  - return begin;
  + return curA;
  }
  };
  