Given a singly-linked list, write a method

Examples:

`isListPalindrome`

to determine if the list is a palindrome. A palindrome is a sequence that reads the same backward as forward.Examples:

`1->2->3->2->1 ==> true`

`1->2->2->3 ==> false`

`1 ==> true`

`null ==> true`

Need a **hand?** Try out these hints, one at a time.

There are multiple ways to solve this problem. The first one involves creating a new reversed list and comparing the

`ListNode`

s of each as you iterate over them. The only drawback with this approach is that you'll be using O(n) space. We can actually solve this problem keeping constant space by reversing the second half of the list! Let's try that one.
Find the middle of the list (If you're feeling fancy, use a slow - fast pointer approach!). Otherwise find the length of the list, halve it and iterate over to the middle node. Reverse the list from here until you reach the end of the list. Start iterating inward from the 2 ends and compare each

`ListNode`

.
public Boolean isListPalindrome(ListNode head) { }

**C**

**Java**

**Python**