Goldman Sachs Interview Question

I didn't managed to get that far :d