5 posts about monotonic stack by 1 contributor.
Know monotonic stack? Share what you know with developers who are learning it.
Find the maximum number of people visible in a line. This problem is solved efficiently using a monotonic stack to find previous and next greater elements.
Master the Stock Span Problem with the Monotonic Stack pattern. Efficiently find consecutive days with lower or equal stock prices in O(n) time.
Learn how to solve the “Remove K Digits” problem using a greedy monotonic stack approach. This article explains how to efficiently remove k digits from a number string to form the smallest possible result while maintaining digit order, along with a Java implementation and clear intuition.
Learn how to find the lexicographically smallest string after removing K characters using a monotonic stack in Java. Includes explanation, dry run, and optimized O(n) solution.
Learn how to solve the Next Element With Greater Frequency problem using HashMap and Monotonic Stack. Includes intuition, dry run, complexity analysis, and optimized Java solution.
DevSocialUpcoming · 3rd editionAI Agents ConferenceNov 23–27, 2026Live onlineMembers only16days leftRegisterPublish an article in this category and earn +1,000 SHARP when it is approved.
Write an article