ShowMax interview question

I was given a LeetCode medium challenge