First Fulfilled with Concurrency Limit

JavaScript Hard 2 views
Back to Questions

Problem Description

Given n numbers and limit k. Task succeeds if x is prime (returns x), else rejects. Run with max k in-flight and print the first fulfilled value in input order; if none, print NONE.

Input Format

Line1: n k. Line2: n integers.

Output Format

Value or NONE.

Sample Test Case

Input:
8 3 1 4 6 7 9 11 15 2
Output:
7

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev