7 monotonic stack interview questions, asked at Google, Amazon, Meta and 1 more company. Last asked Sep 2026.
Next greater element in a circular arrayCodingYou get an integer array that wraps around: after the last element, scanning continues from the first. For every index, return the first value strictly greater than its own that…
Last asked Sep 2026
Count visible people in a lineCodingPeople stand in a line and heightsi is the height of the person at position i. Two people can see each other when nobody standing between them is taller than both of them. First…
Last asked Jul 2026
Final prices after next-lower-price discountsCodingYou get a list of prices. Each item is discounted by the first later price that is lower than it (agree whether an equal price counts); an item with no such price pays full price…
Last asked Feb 2026
Longest subarray whose ends exceed everything betweenCodingGiven an integer array, return the length of the longest contiguous subarray whose first and last elements are both greater than every element strictly between them. Do better…
Last asked Sep 2025
Task delay times from the farthest smaller priorityCodingTask priorities are given in an array and processed from right to left. A task's delay time is the distance from it to the farthest task on its right that has a smaller priority…
Last asked Sep 2025
Buildings with an ocean viewCodingBuildings stand in a row with the ocean to the right. A building has a view if every building to its right is shorter. Return the indices with a view in increasing order, scanning…
Last asked Aug 2025
Greatest three-digit subsequenceCodingYou are given a list digits of single digits (each 0–9). Choose at most three of them, keep them in their original order, and read them left to right as a number. Return the…
Question types
Monotonic stack interview questions · Land the Lab