본문 바로가기
Leetcode

[LeetCode] Delete Node in a Linked List 파이썬 (linked list)

by YGSEO 2021. 4. 7.
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

댓글