next greater element
RU: следующий больший элемент
For each element in an array, the next element to its right that is larger than it. If no such element exists, return −1. The monotonic stack pattern solves this in O(n) time.
RU: следующий больший элемент
For each element in an array, the next element to its right that is larger than it. If no such element exists, return −1. The monotonic stack pattern solves this in O(n) time.