魔法师 (@Constanline)Leetcode每日一题 —— 2058. 找出临界点之间的最小和最大距离 中发帖

思路
模拟即可。 
代码

class Solution {
    public int[] nodesBetweenCriticalPoints(ListNode head) {
        if (head.next == null || head.next.next == null) {
            return new int[]{ -1, -1 };
        }
        int mnDist = Integer.MAX_VALUE;
        int mxDist = 0;
        int idx = 0;
        int last = head.val;
        int first = -1;
        int lastIdx = -1;
        ListNode cur = head.next;...
 
 
Back to Top