234. Palindrome Linked List
Problem description:
Given the head of a singly linked list, return true if it is a palindrome.
Example 1:
1 | Input: head = [1,2,2,1] |
Example 2:
1 | Input: head = [1,2] |
Solution:
1 | def isPalindrome(self, head): |
time complexity: $O(n)$
space complexity: $O(1)$
reference:
related problem: