Problem
Given thehead of a singly linked list, return true if it is a palindrome or false otherwise.
Examples
Constraints
- The number of nodes in the list is in the range [1, 10^5].
- 0 <= Node.val <= 9
O(n) time and O(1) space?
Tested Python solution for LeetCode 234 with 16 pytest cases. Generate a practice environment with lcpy.
head of a singly linked list, return true if it is a palindrome or false otherwise.
O(n) time and O(1) space?