Tagged articles

Monotonic Stack

4 articles · Page 1 of 1
Java Tech Enthusiast
Java Tech Enthusiast
Dec 7, 2024 · Interview Experience

Solve LeetCode 739 ‘Daily Temperatures’ Using a Monotonic Stack

This article explains the LeetCode 739 'Daily Temperatures' problem, describing how to compute the next warmer day for each temperature using a monotonic stack, and provides complete implementations in Java, C++, and Python, along with step‑by‑step analysis and example walkthroughs.

AlgorithmC++Daily Temperatures
0 likes · 6 min read
Solve LeetCode 739 ‘Daily Temperatures’ Using a Monotonic Stack
IT Services Circle
IT Services Circle
Nov 21, 2023 · Fundamentals

LeetCode 42 – Trapping Rain Water: Problem Overview and Three O(n) Solution Techniques (Two‑Pointer, Prefix‑Max, Monotonic Stack)

This article explains LeetCode problem 42 “Trapping Rain Water”, detailing the problem statement, example, and three efficient O(n) solution approaches—two‑pointer, prefix‑max arrays, and a monotonic stack—each accompanied by complete Java implementations and analysis of their logic.

LeetCodeMonotonic StackPrefix Max
0 likes · 7 min read
LeetCode 42 – Trapping Rain Water: Problem Overview and Three O(n) Solution Techniques (Two‑Pointer, Prefix‑Max, Monotonic Stack)
Nullbody Notes
Nullbody Notes
Nov 14, 2023 · Interview Experience

Finding the Shortest Unsorted Subarray with a Monotonic Stack in Go

The article explains how to locate the left and right boundaries of the unsorted segment in LeetCode 581 by using two monotonic stacks that store indices, and provides a complete Go implementation that returns the length of the shortest subarray whose sorting makes the whole array ordered.

LeetCodeMonotonic Stack
0 likes · 4 min read
Finding the Shortest Unsorted Subarray with a Monotonic Stack in Go