Rising Packet Energy Audit
Preview mode. Log in to edit, run, submit, and save progress.
Rising Packet Energy Audit
A telemetry replay lists packet energy readings in their original order. A packet batch is called rising when it is contiguous and every packet after the first has strictly greater energy than the packet immediately before it. The energy of a rising batch is the sum of all readings inside that batch. You may choose exactly one contiguous rising batch from the replay, and the batch can have length one if no extension is possible. Input Format: You are given an integer array packets. Output Format: Return the maximum total energy of any strictly rising contiguous batch.
Examples
packets = [10, 20, 30, 5, 10, 50]
65
Explanation: The strongest strictly rising batch is [5, 10, 50]. Its sum is 65, so the output is 65.
Approach hint
Only the immediately previous packet decides whether the current batch continues.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.