CoStar Group interview question

whiteboarding problem to implement stack and functions