Sprinklr interview question

One question leetcode medium on implementation of stack