精華區beta Marginalman 關於我們 聯絡資訊
好久沒有遇到linked list了 有過就好 對ㄚ== 一二三四五 def mergeNodes(self, head: Optional[ListNode]) -> Optional[ListNode]: def help(head, cur_sum): if head is None: return None elif head.val == 0: n = ListNode(cur_sum) n.next = help(head.next, 0) return n else: return help(head.next, cur_sum+head.val) return help(head,0).next -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.229.37.69 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1720051901.A.668.html ※ 編輯: DJYOMIYAHINA (125.229.37.69 臺灣), 07/04/2024 08:11:57
sustainer123: 大師 07/04 08:18
rainkaras: 大師 07/04 08:37
smart0eddie: 大師 07/04 13:55