Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use another array to keep track of marked indices.
Sort the array <code>nums</code> to be able to find the smallest unmarked elements quickly in each query.
Solve with full IDE support and test cases