Tap here to switch tabs
Problem
Submissions

Problem: Sum of Even Numbers After Queries

Try to solve the Sum of Even Numbers After Queries problem.

Statement

You are given an integer array nums and an array of queries queries, where each queries[i] is a pair [val_i, index_i].

For each query queries[i], apply the update nums[index_i] = nums[index_i] + val_i. After modifying nums, compute the sum of all even values currently present in the array.

Return an integer array representing the sum of even numbers after applying each query sequentially.

Constraints:

  • 1≤1 \leq nums.length ≤104\leq 10^4

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

  • 1≤1 \leq queries.length ≤104\leq 10^4

  • −104≤-10^4 \leq val_i ≤104\leq 10^4

  • 0≤0 \leq index_i << nums.length

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Even Numbers After Queries

Try to solve the Sum of Even Numbers After Queries problem.

Statement

You are given an integer array nums and an array of queries queries, where each queries[i] is a pair [val_i, index_i].

For each query queries[i], apply the update nums[index_i] = nums[index_i] + val_i. After modifying nums, compute the sum of all even values currently present in the array.

Return an integer array representing the sum of even numbers after applying each query sequentially.

Constraints:

  • 1≤1 \leq nums.length ≤104\leq 10^4

  • −104≤-10^4 \leq nums[i] ≤104\leq 10^4

  • 1≤1 \leq queries.length ≤104\leq 10^4

  • −104≤-10^4 \leq val_i ≤104\leq 10^4

  • 0≤0 \leq index_i << nums.length