class Solution {
public boolean isPalindrome(ListNode head) {
ListNode temp=head;
boolean flag = true;
int a [] = new int [100000];
int c = 0,k;
while(temp!=null)
{
a[c] = temp.val;
c++;
temp = temp.next;
}
k=c-1;
for (int i=0; i<c/2; i++)
{
if(a[i]!=a[k])
{
flag = false;
break;
}
k--;
}
return flag;
}}