diff --git a/interviewQuestions/IsPalindrome LinkedList b/interviewQuestions/IsPalindrome LinkedList new file mode 100644 index 0000000..1919e81 --- /dev/null +++ b/interviewQuestions/IsPalindrome LinkedList @@ -0,0 +1,14 @@ + public boolean isPalindrome(ListNode head) { + if(head==null || head.next==null) return true; + + ListNode mid=mid(head); + ListNode rev=reverse(mid); + while(rev!=null) + { + if(head.val!=rev.val) return false; + head=head.next; + rev=rev.next; + } + + return true; + }