Run Until First Success (Parallel)

JavaScript Hard 3 views
Back to Questions

Problem Description

Given n values. For each value x, async task succeeds if x%3==0 and returns x. Run all tasks in parallel and print the smallest successful value, else print NONE.

Input Format

Line1: n. Line2: n integers.

Output Format

Value or NONE.

Sample Test Case

Input:
6 4 7 9 10 12 5
Output:
9

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next