728x90
class Solution:
def deleteNode(self, node):
if node and node.next:
node.val = node.next.val # swap current val to next val
node.next = node.next.next # jump next to next.next

728x90
'Leetcode' 카테고리의 다른 글
| [LeetCode] Binary Tree Paths 파이썬 (Binary Tree, LCA, DFS) (0) | 2021.04.07 |
|---|---|
| [LeetCode] Valid Anagram 파이썬 (dict) (0) | 2021.04.07 |
| [LeetCode] Lowest Common Ancestor 파이썬 (tree) (0) | 2021.04.07 |
| [LeetCode] Palindrome Linked List 파이썬 (0) | 2021.04.06 |
| [LeetCode] Summary Ranges 파이썬 (0) | 2021.04.06 |
댓글