Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.
Recursive
public class Solution {
private ListNode head;
private boolean helper(ListNode tail) {
if(tail == null) return true;
if(helper(tail.next) && head.val == tail.val){
head = head.next;
return true;
}else return false;
}
public boolean isPalindrome(ListNode tail){
head = tail;
return helper(tail);
}
}