看板 Marginalman 關於我們 聯絡資訊
※ 引述《SecondRun (南爹摳打)》之銘言: : 237.刪除linked list裡的一個node : input只會給要刪除的node : 想法: : 沒辦法把上一個node直接接到下一個node : 那就把要刪除的node資料換成下一個node的 : C# code : public class Solution { : public void DeleteNode(ListNode node) { : node.val = node.next.val; : node.next = node.next.next; : } : } : 這也有medium : 屋搜打囉 思路: 完全一樣 Python Code: # Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def deleteNode(self, node): """ :type node: ListNode :rtype: void Do not return anything, modify node in-place instead. """ node.val = node.next.val node.next = node.next.next 本來想說等cnn跑的時候 刷題耗個時間 結果今天好簡單 哇哇嗚嗚嗚 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.43.133.194 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1714881419.A.48F.html
wu10200512: 大師 05/05 11:57
edieedie: 挖操這三小 05/05 11:58
DJYOSHITAKA: 剩我不會了 05/05 11:59
SecondRun: 大師 05/05 12:14
JIWP: 別卷了 05/05 13:14