Code AnalysisIntermediate 60s
Trace: Sliding Window
What is the maximum sum of 3 consecutive elements in [2, 1, 5, 1, 3, 2]?
Windows: 2+1+5=8, 1+5+1=7, 5+1+3=9, 1+3+2=6
Starter code
// Array: [2, 1, 5, 1, 3, 2], k=3 // Window 1: 2+1+5 = 8 // Window 2: 1+5+1 = 7 // Window 3: 5+1+3 = 9 // Window 4: 1+3+2 = 6 // Max = 9
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.