@@ -0,0 +1,976 @@
+package com.interview.linklist;%0A%0A/**%0A * http://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/ %0A * Test cases:%0A * odd number of nodes%0A * even number of nodes%0A * 0 1 or more nodes%0A * palindrome list%0A * non palindrom list%0A */%0Apublic class LinkListIsPalindrome %7B%0A%0A%09public boolean isPalindrome(NodeRef head,Node end)%7B%0A%09%09if(end == null)%7B%0A%09%09%09return true;%0A%09%09%7D%0A%09%09boolean r = isPalindrome(head,end.next);%0A%09%09r = r && head.node.data == end.data;%0A%09%09head.next();%0A%09%09return r;%0A%09%7D%0A%09%0A%09public static void main(String args%5B%5D)%7B%0A%09%09LinkList ll = new LinkList();%0A%09%09Node head = null;%0A%09%09head = ll.addNode(1, head);%0A%09%09head = ll.addNode(2, head);%0A%09%09head = ll.addNode(3, head);%0A%09%09head = ll.addNode(4, head);%0A%09%09head = ll.addNode(3, head);%0A%09%09head = ll.addNode(2, head);%0A%09%09head = ll.addNode(1, head);%0A%09%09NodeRef nodeRef = new NodeRef();%0A%09%09nodeRef.node = head;%0A%09%09LinkListIsPalindrome llp = new LinkListIsPalindrome();%0A%09%09System.out.println(llp.isPalindrome(nodeRef, head));%0A%09%7D%0A%7D%0A

Linklist is palindrome or not