Given a singly linked list, determine if it is a palindrome.
Example
No.1
Input: 1->2
Output: false
No.2
Input: 1->2->2->1
Output: true
Follow up
Could you do it in O(n) time and O(1) space?
Code
1 | public class ListNode { |
1 | public boolean isPalindrome(ListNode head) { |