Pregunta de entrevista de Goldman Sachs

String manipulation problems by reducing time complexity, space complexity and both at the same time.