NeetCode #316LC-2181MediumLinked List
← Back to All Problems

#316 · #2181 · Merge Nodes in Between Zeros(合并零之间的节点)

📌 Problem Statement & Constraints

You are given the head of a linked list where consecutive sequences of nodes are separated by nodes with value 0, and the list begins and ends with 0. Merge each sequence between two zeros into a single node holding the sum, and return the modified list. Constraints: 3 <= number of nodes <= 10^5, 0 <= Node.val <= 1000.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!