```
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
int lenA = 0;
int lenB = 0;
ListNode *_headA, *_headB;
_headA = headA; _headB = headB;
while(_headA){
//_headA++
_headA = _headA->next;
lenA++;
}
while(_headB){
//_headB++
_headB = _headB->next;
lenB++;
}
while(lenA>lenB){
//headA++
headA = headA->next;
lenA--;
}
while(lenA<lenB){
//headB++
headB = headB->next;
lenB--;
}
while(headB != headA){
//headA++;headB++;
headA = headA->next;
headB = headB->next;
}
return headA;
}
};
```

- get the length of A and B;
- if length of A is bigger than length of B, then A is backward.
- B is same as A
- if length of A equals length of B, then compare

but if I use headA++ to replace headA->next, it will get TLE