Pergunta de entrevista da empresa Amazon

find the maximum sequence with segments