Goldman Sachs Interview Question

one dsa question based on stacks and one on linked lists