Plivo interview question

Stack-based medium problem was asked.