This problem asks to determine if a singly linked list is a palindrome. My original idea was to reverse the first half of the linked list and then traverse again, which should meet the time complexity $O(n)$ and space complexity $O(1)$ requirements, but it kept getting a time limit exceeded error for some reason.
After checking the discuss section and hints, a simple recursion actually works.
| |