## Sample interview problems

#### Palindrome Linked List

This problem asks whether a given singly linked list is a palindrome. A palindrome is a word, phrase, or sequence that reads the same backward as forward. In this case, the list is a palindrome if the elements in the list read the same forward as backward.

#### Problem

```Given a singly linked list, write a function to check if the list is a palindrome. Return true if it is, false otherwise.
Input: 1->2->3->2->1
Output: true```

#### Solution

This solution is in Python. Our A.I. can create solutions in multiple languages.
```# 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: ListNode) -> bool:
return True
while fast and fast.next:
slow = slow.next
fast = fast.next.next
if fast:
slow = slow.next
slow = self.reverse(slow)
while slow:
if slow.val != head.val:
return False
slow = slow.next
return True