#3653
XOR After Range Multiplication Queries I
medium · 73.9% accepted · 31 likes · top 84%
array · divide and conquer · simulation
Description
You are given an integer array nums of length n and a 2D integer array queries of size q, where queries[i] = [li, ri, ki, vi].
For each query, you must apply the following operations in order:
- Set idx = li.
- While idx <= ri:
- Update: nums[idx] = (nums[idx] * vi) % (109 + 7)
- Set idx += ki.
Return the bitwise XOR of all elements in nums after processing all queries.
Solution