Pregunta de entrevista de Microsoft

String manipulation and matrix related math question