LessonΒ·difficulty 2/5Β·~15 min
Build a capped retry schedule
Implement retry_delays(attempts, base_ms, cap_ms).
Return one delay per retry attempt. The first delay is base_ms; each following delay doubles until cap_ms. Cap every delay, including the first. attempts is a non-negative integer; base_ms and cap_ms are positive integers. This deterministic exercise omits jitter.
Before coding, predict one result by hand. After the tests pass, explain your approach and add a boundary example of your own.
Tests
- Case 1
- Case 2
- Case 3
β¦ Stuck? Ask for a spark
Sign in or create a free account to use your monthly AI explainer allowance.
warming up
Loading editorβ¦
Consolewaiting
$ Console output will appear here.