Closed MuhammadTausif closed 2 hours ago
class Solution:
def isPalindrome(self, head):
a=head
l=[]
while a:
l.append(a.data)
a=a.next
if l == l[::-1]:
return True
return False
Palindrome Linked List
Link
Difficulty: Medium
Given a singly linked list of integers. The task is to check if the given linked list is palindrome or not.
Examples:
Note: You should not use the recursive stack space as well
Constraints: