Skip to content

Commit b084b0f

Browse files
committedAug 12, 2019
2019-08-12
1 parent f83e627 commit b084b0f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎0234.回文链表/0234-回文链表.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ def isPalindrome(self, head):
1010
:type head: ListNode
1111
:rtype: bool
1212
"""
13-
stack = []
14-
while(head):
15-
stack.append(head.val)
16-
head = head.next
17-
return stack == stack[::-1]
18-
13+
p = head
14+
l = []
15+
while p:
16+
l.append(p.val)
17+
p = p.next
18+
return l == l[::-1]

0 commit comments

Comments
 (0)