Problems

Retry Until Success

MediumAsync & Promises

An async operation fails until a known attempt number. Input: line 1 — the attempt on which it succeeds (s); line 2 — max retries allowed (m). Implement retry logic and print success after N attempts if N ≤ m, otherwise failed after m attempts.

Input: two integers. Output: one status line.

Your program reads from stdin and prints to stdout.

Example 1

Input: 3 5

Output: success after 3 attempts

Hints

JavaScriptAsyncRetry