• + 3 comments

    The "max stack" contains all the distinct max values, so after popping from the max stack, the "max stack" top would have the max of all the elements in the "elements stack", which makes the "elements stack" redundant.