hardArrayMathNumber TheorySegment Tree 0 views

Maximize Count of Distinct Primes After Split

You are given an integer array nums having length n and a 2D integer array queries where queries[i] = [idx, val].

You are given an integer array nums having length n and a 2D integer array queries where queries[i] = [idx, val].

For each query:

Note: The changes made to the array in one query persist into the next query.

Return an array containing the result for each query, in the order they are given.

Example 1

Input: nums = [2,1,3,1,2], queries = [[1,2],[3,3]]

Output: [3,4]

Example 2

Input: nums = [2,1,4], queries = [[0,1]]

Output: [0]

Constraints

  • 2 <= n == nums.length <= 5 * 10^4
  • 1 <= queries.length <= 5 * 10^4
  • 1 <= nums[i] <= 10^5
  • 0 <= queries[i][0] < nums.length
  • 1 <= queries[i][1] <= 10^5

Hints

Companies

No companies reported yet.

Discussion

Sign in to join the discussion.

Loading discussion...

Test results

No test cases yet.