Amazon Interview Question

find the maximum sequence with segments