Pregunta de entrevista de Amazon

find the maximum sequence with segments