The optimist, the pessimist and the longest sequence
An optimist and a pessimist look at the same finite list of real numbers. The optimist says: "The sum of any eight consecutive terms is positive." The pessimist says: "The sum of any five consecutive terms is negative."
Can they both be right? If so, what is the longest list for which both statements can hold? Give an example of maximum length and prove nothing longer works.
Show a hint
Suppose there are 12 terms. Arrange them in a 5-row by 8-column table where the entry in row i, column j is the term in position i + j (numbering rows 0 to 4 and columns 1 to 8). Add up the table by rows, then by columns.
Your answer
Solving needs a free account
Answers, streaks and solutions unlock when you are signed in. Reading the question and the hint stays free.
Discussion
💡 Discussion rules
- No full solutions here. Hints and approaches only.
- Complexity, edge cases and intuition are the point.
- Interview experiences are welcome. Respect your NDAs.
Loading discussion…
Learn the concepts
The theory behind this question.