Function to check if a singly linked list is palindrome

def check_palindrome(self):
stack = []
temp = self.head
while(temp):
stack.append(temp.data)
temp = temp.next
stack1 = stack[::-1]
if stack1 == stack:
return True
return False

--

--

Sairam Penjarla

Looking for my next opportunity to make change in a BIG way