Goldman Sachs interview question

Few puzzles and design questions