Last executed input: Intersected at '1': {1,2,3,4,5,6,7,8,9,10,11,12,13}, {1,2,3,4,5,6,7,8,9,10,11,12,13}

Why? I think my complexity is O(N). Could anyone help me?Thanks a lot.

```
public class Solution {
public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
if(headA == null)
return null;
if(headB == null)
return null;
ListNode lastOfA = getLastNode(headA);
ListNode lastOfB = getLastNode(headB);
if(lastOfA != lastOfB)
return null;
int x = getLength(headA);
int y = getLength(headB);
ListNode newHead = inverseList(headA);
int z = getLength(headB);
int loc = (y - x + z + 1)/2;
inverseList(newHead);
ListNode node = headB;
for(int i=0;i<loc-1;i++)
node = node.next;
return node;
}
public ListNode getLastNode(ListNode head){
if(head == null)
return null;
if(head.next == null)
return head;
ListNode cur = head;
while(cur.next != null){
cur = cur.next;
}
return cur;
}
public int getLength(ListNode head){
if(head == null)
return 0;
int length = 0;
ListNode cur = head;
while(cur != null){
length++;
cur = cur.next;
}
return length;
}
public ListNode inverseList(ListNode head){
if(head == null)
return null;
if(getLength(head) == 1)
return head;
ListNode pre = null;
ListNode cur = null;
ListNode next = null;
if(getLength(head) == 2){
pre = head;
cur = head.next;
cur.next = pre;
pre.next = null;
return cur;
}
pre = head;
cur = head.next;
while(cur != null){
next = cur.next;
cur.next = pre;
pre = cur;
cur = next;
}
return pre;
}
}
```