AT&T interview question

apply a stack with an array