Data Structure Algorithm Interview Question for Automation Testers
Monday, January 25, 2016
Is LinkedList Even in Java
public int isLinkedListEven(ListNode head){
while(head!= null && head.getNext()!= null){
head = head.getNext().getNext();
}
if(head == null){
return 0;
}
else{
return 1;
}
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment