Smiths Detection interview question

stack using linked list question