MediumPro challengePythonJavaScriptTypeScript
Compute Backoff Delays
BackendAsyncMath
Generate exponential backoff delays with optional jitter cap.
solve(base, attempts, max) returns array of min(base * 2^i, max) for i in 0..attempts-1.
Sample tests
Test #1Zero attempts
Input: [1,0,1000]
Output: []
Test #2Always capped
Input: [1000,3,100]
Output: [100,100,100]
Test #3No cap hit
Input: [100,4,10000]
Output: [100,200,400,800]
Test #4Cap kicks in
Input: [100,5,500]
Output: [100,200,400,500,500]
Test #5Single attempt
Input: [50,1,1000]
Output: [50]