Python, LintCode, 372. Delete Node in a Linked List

"""
Definition of ListNode
class ListNode(object):

    def __init__(self, val, next=None):
        self.val = val
        self.next = next
"""


class Solution:
    """
    @param: node: the node in the list should be deletedt
    @return: nothing
    """
    def deleteNode(self, node):
        # write your code here
        node.val = node.next.val
        node.next = node.next.next
        return

阅读更多
文章标签: Python LintCode
个人分类: LintCode
上一篇Python, LeetCode, 110. 平衡二叉树
下一篇Python, LeetCode, 56. 合并区间
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭