Goldman Sachs Interview Question

mostly on strings and queues