Skip to content

Commit 793a160

Browse files
committed
Time: 796 ms (50.48%), Space: 49.2 MB (29.67%) - LeetHub
1 parent c0008b5 commit 793a160

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution:
2+
def isPalindrome(self, head: Optional[ListNode]) -> bool:
3+
pointer = head
4+
arr = []
5+
while pointer:
6+
arr.append(pointer.val)
7+
pointer = pointer.next
8+
9+
n = len(arr)
10+
for i in range(n//2):
11+
if arr[i] != arr[n-1-i]:
12+
return False
13+
return True

0 commit comments

Comments
 (0)