Maximum sum window of size k
Given a series of per-minute PnL values and a window length k, find the best total PnL over any k consecutive minutes.
pnl = [1, -2, 3, 4, -1, 2], k = 3
-> 6 # window [3, 4, -1]
Return the maximum sum over all windows of exactly k consecutive elements. Aim for , recomputing each window from scratch is .
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.