Amazon interview question

Min stack leetcode hard question