The Output Peak
A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L5
Problem
A monitoring job emits net-throughput readings run-length encoded in `readings` as `[value, count]` pairs, where one pair can stand in for hundreds of millions of identical readings. Find the consecutive run of readings with the greatest total and return that total together with the run, given back as the `[value, count]` pairs that cover it. The input always holds at least one reading and the run can never be empty, so when every reading is negative the answer is the single least-negative one; if several runs tie for the greatest total, take the one that starts earliest.
Summary
One stretch outpaced all the others.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.