Morgan Stanley Interview Question

medium leedcode on data .structures , related to stack