Find the Minimum and Maximum Number of Nodes Between Critical Points - Leetcode 2058 - Java

Поділитися
Вставка
  • Опубліковано 5 лип 2024
  • Problem Description
    Program to find [minDistance, maxDistance] where minDistance is the minimum distance between any two distinct critical points and maxDistance is the maximum distance between any two distinct critical points. If there are fewer than two critical points, return [-1, -1].
    A critical point in a linked list is defined as either a local maxima or a local minima.
    A node is a local maxima if the current node has a value strictly greater than the previous node and the next node.
    A node is a local minima if the current node has a value strictly smaller than the previous node and the next node.
    Note that a node can only be a local maxima/minima if there exists both a previous node and a next node.
    Problem: leetcode.com/problems/find-th...
    Code link: k5kc.com/cs/algorithms/find-t...

КОМЕНТАРІ •