My ans


  • 0
    N

    '''bool isPalindrome(ListNode* head) {

    	static ListNode* temp = head;
    	if (head == NULL) return true;
    
    	if(!isPalindrome(head->next))
    		return false;
    
    	if (temp->val != head->val)
    	{
    		return false;
    	}
    	else if(temp->next){
    		temp = temp->next;
    	}
    	else
    	{
    		return true;
    	}
    
    }'''

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.