The problem, in one line. Given the heights of bars standing side by side, each one wide, find the area of the biggest rectangle that fits inside them. LeetCode 84.
The tell. The best rectangle is limited by its shortest bar, so for each bar you want the nearest shorter bar on each side. That is the “next smaller” question, and a stack of rising heights answers it.