Trains the technique from
LeetCode 3653XOR After Range Multiplication Queries IThis is an original problem, written from a brief that listed the technique, the difficulty, the topics, the function shape and the input bounds — none of that problem's wording, examples, hints or editorials. The link is there so you can map your practice onto the standard set.
Same function shape, different story and different numbers.
Meter readings are given as nums, and a list of adjustments as queries. Each adjustment is [l, r, k, v] and multiplies, modulo 10^9 + 7, the readings at positions l, l + k, l + 2k and so on, taking every such position up to and including r.
Apply the adjustments in the order given, then return the bitwise exclusive-or of the whole list of readings.
Example 1
The first adjustment strides by two from position 0, so it triples the readings at 0, 2 and 4. The second strides by one from position 1 through 3, so it multiplies those three by seven. Combining the finished readings bitwise gives this.
Example 2
Striding by three from position 0 reaches positions 0 and 3 only, doubling those two readings and leaving the other four alone.
Example 3
Multiplying by one changes nothing, so the answer is the readings combined as they came.
The editor is preloaded with this. It matches the parent problem's shape, so a solution that works here transfers to a judge unchanged.
def xor_after_queries(nums: list[int], queries: list[list[int]]) -> int:public int xorAfterQueries(int[] nums, int[][] queries)See the step-by-step animation, the intuition, and clean code in every language — free, no credit card.