# Can anyone tell me what's wrong with my code?

• I got MLE.
I have tested in eclipse, I found a circle, but I don't know how I get this circle. Somebody help, please.

`````` /**
* public class ListNode {
*     int val;
*     ListNode next;
*     ListNode(int x) { val = x; }
* }
*/
public class Solution {
while(it.next!=null){
it = it.next;
}
}
private ListNode sortList(ListNode s, ListNode e){
if(s == e || e == null || s == null) return s;
ListNode pivot = e;
ListNode it = s;
ListNode pre = null;
while(it != pivot){
if(it.val >= pivot.val){
if(it == s){
s = it.next;
it.next = null;
e.next = it;
e = it;
it = s;
}
else{
pre.next = it.next;
it.next = null;
e.next = it;
e = it;
it = pre.next;
}
}
else{
pre = it;
it = it.next;
}
}
while(it.next!=null)
it = it.next;
it.next = pivot;
pivot.next = sortList(pivot.next, e);
}
}``````

• public class Solution {
while(it.next!=null){
it = it.next;
}
}
private ListNode sortList(ListNode s, ListNode e){
if(s == e || s == null) return s;
e.next = null;
ListNode pivot = e;
ListNode it = s;
ListNode pre = null;
while(it != pivot){
if(it.val >= pivot.val){
if(it == s){
s = it.next;
it.next = null;
e.next = it;
e = it;
it = s;
}
else{
pre.next = it.next;
it.next = null;
e.next = it;
e = it;
it = pre.next;
}

``````        }
else{
pre = it;
it = it.next;
}
}
if(s != pivot){
while(it.next!=null)
it = it.next;
it.next = pivot;
}else