Skip to content

Commit

Permalink
Time: 70 ms (16.71%), Space: 14 MB (20.71%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Kim-GeonHo committed Sep 28, 2022
1 parent f22a6c1 commit f3c6837
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ def removeNthFromEnd(self, head: Optional[ListNode], n: int) -> Optional[ListNod
len_ += 1
temp = temp.next

if len_ - n == 0:
if len_-n == 0:
return head.next

x = head
for i in range(max(0, len_ - n - 1)):
for i in range(len_-n-1):
x = x.next

x.next = x.next.next
Expand Down

0 comments on commit f3c6837

Please sign in to comment.