Skip to content

Commit 17cb5a7

Browse files
committed
undo reverse for input ll
1 parent a89e5d8 commit 17cb5a7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Python/chapter02/2.6 - Palindrome/miguel_2.6_soln.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,11 @@ def is_palindrome_constant_space(ll: LinkedList) -> bool:
180180
n2 = temp_ll2.head
181181
for _ in range(temp_ll2.size):
182182
if n1.data != n2.data:
183+
temp_ll2.reverse()
183184
return False
184185
n1 = n1.next
185186
n2 = n2.next
187+
temp_ll2.reverse()
186188
return True
187189

188190

0 commit comments

Comments
 (0)