A stack with push, pop and top that can also report its largest element — with top in O(1) and everything else in O(log n).
A stack with push, pop and top that can also report its largest element — with top in O(1) and everything else in O(log n).
Opens with the full question.