1.删除链表中的节点https://leetcode-cn.com/problems/delete-node-in-a-linked-list/

一开始没看清题目中传入的参数为“要被删除的节点”,找了半天链表在哪

 1 class ListNode:
 2     def __init__(self, x):
 3         self.val = x
 4         self.next = None
 5 
 6 class Solution:
 7     def deleteNode(self, node):
 8         """
 9         :type node: ListNode
10         :rtype: void Do not return anything, modify node in-place instead.
11         """
12         node.val = node.next.val
13         node.next = node.next.next

时间复杂度82%

 

 

2.除自身以外数组的乘积https://leetcode-cn.com/problems/product-of-array-except-self/

 

 

 

3.Nim游戏https://leetcode-cn.com/problems/nim-game/

 

posted on 2021-01-27 21:24  zmbreathing  阅读(63)  评论(0编辑  收藏  举报