Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given the head of a singly linked list, return true if it is a palindrome or false otherwise.
 
Please complete the following python code precisely:
```python
# Definition for singly-linked list.
# class ListNode:
#     def __init__(self, val=0, next=None):
#         self.val = val
#         self.next = next
class Solution:
    def isPalindrome(self, head: Optional[ListNode]) -> bool:
```