Walmart interview question

A 45 minutes coding question (standard stack question)