Pregunta de entrevista de Microsoft

asked regex question involving dynamic programming