DEV Community

Shaan Yadav
Shaan Yadav

Posted on

Min Max Nodes Between Critical Points | LEETCODE 2058 | Solve In Seconds | Amazon Interview |

Min Max Nodes Between Critical Points | LEETCODE 2058 | Solve In Seconds | Amazon Interview |

This video covers LeetCode 2058 — Find the Minimum and Maximum Number of Nodes Between Critical Points. A medium-difficulty linked list problem asked at Amazon, Google, Meta, and Microsoft. The solution uses a three-node sliding window (previous, current, next) to detect local maxima and local minima in a single O(n) pass. The optimal O(1) space approach tracks only four variables: firstCriticalIndex, previousCriticalIndex, minDistance, and currentIndex. An alternative ArrayList approach stores all critical indices and scans for min/max distance. Edge cases covered: fewer than two critical points returns [-1, -1], strictly increasing/decreasing lists, and tied values.

🚀 Cracking Amazon / Google interviews? Get every new LeetCode solution the moment it drops. Join 2,000+ coders who never miss a walkthrough:

Find the Minimum and Maximum Number of Nodes Between Critical Points is a medium linked list problem asked at Amazon, Google, Meta, and Microsoft — the easiest two-pointer explanation with both O(1) and O(n) space solutions explained in seconds.

LeetCode Question: https://leetcode.com/problems/find-the-minimum-and-maximum-number-of-nodes-between-critical-points/
Solution (Java / Python / C++ / C): https://github.com/Shaanworkspace/YOUTUBE-DRIVE/blob/main/Leetcode_Daily/LC_2058_Find_the_Minimum_and_Maximum_Number_of_Nodes_Between_Critical_Points_All_Languages.md

Why this approach beats the others

  1. Company angle: "Amazon Most Asked Interview" — no competitor owns this for LC 2058.
  2. Two approaches: O(1) space optimal + ArrayList walkthrough — competitors show only one.
  3. "Solve In Seconds" promise — unique hook for this specific problem.
  4. O(n) to O(1) Space Complexity text on thumbnail — the exact upgrade interviewers want to see.
  5. FAANG company logos on thumbnail (Amazon, Google, Meta, Microsoft) — instant credibility.
  6. Long-tail keyword coverage: "three-node window", "local maximum minimum linked list", "critical points O(1) space" — competitors miss these.

Notes for US interview prep

  • Schedule in EST window: Tue/Wed 2-4 PM EST or Sun 10 AM EST
  • Upload accurate English .srt captions (cam.srt grounded)
  • Company playlists: Amazon LeetCode, Google LeetCode, Meta LeetCode, Microsoft LeetCode
  • Long-form hashtags trimmed to 3-5
  • English metadata (American spelling: behavior, optimize, color)

📺 Watch the full walkthrough on YouTube:

Watch the full Min Max Nodes Between Critical Points | LEETCODE 2058 | Solve In Seconds | Amazon Interview | walkthrough on YouTube


🚀 Cracking Amazon / Google interviews? Get every new LeetCode solution the moment it drops. Join 2,000+ coders who never miss a walkthrough:

Top comments (0)