Anonymous Content interview question

coding question based on array and stack