Pinterest interview question

Simple stack iteration