NeetCode #317LC-2058MediumLinked List
← Back to All Problems#317 · #2058 · Find the Minimum and Maximum Number of Nodes Between Critical Points(找出临界点之间的最小和最大距离)
📌 Problem Statement & Constraints
A critical point in a linked list is either a local minimum or a local maximum. Given the head of a linked list, return
[minDistance, maxDistance] where the distances are between pairs of critical points; if there are fewer than two, return [-1, -1]. Constraints: the number of nodes is in [2, 10^5], 1 <= Node.val <= 10^5.🔒
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!