This is my code .
public void evenAfterOdd() throws Exception {
Node temp = head ;
int i = 0 ; int counter = 0 ;
// counting number of even elements
while(temp.next != null){
if(temp.data % 2 == 0){
counter ++ ;
}
temp = temp.next ;
}
temp = head ;
int count = 0 ;
// moving all even elements to end
while(count < counter) {
boolean visited = false ;
if(temp.data % 2 == 0){
visited = true ;
int rv =removeAt(i) ;
addLast(rv) ;
count ++ ;
}
if(visited){
temp = getNodeAt(i) ;
}
else{
i++ ;
temp = temp.next ;
}
}
}
Only 1 test case is failing for the code I have written . Can you tell me for which sequence of elements is my code failing ?