Daisy Group interview question

The leetcode question on stack and queue