From 173d5dd962fc4c3bce181d9c1d79b737eb9ea86f Mon Sep 17 00:00:00 2001 From: Deb kumar Mondal <159232491+Debkumarkatwa@users.noreply.github.com> Date: Sun, 17 Aug 2025 12:37:17 +0530 Subject: [PATCH] add solutions to lc problem: No.3653 --- .../Solution.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 solution/3600-3699/3653.XOR After Range Multiplication Queries I/Solution.py diff --git a/solution/3600-3699/3653.XOR After Range Multiplication Queries I/Solution.py b/solution/3600-3699/3653.XOR After Range Multiplication Queries I/Solution.py new file mode 100644 index 0000000000000..ec1ee7051e610 --- /dev/null +++ b/solution/3600-3699/3653.XOR After Range Multiplication Queries I/Solution.py @@ -0,0 +1,18 @@ +class Solution: + def xorAfterQueries(self, nums: list[int], queries: list[list[int]]) -> int: + MOD = 10**9 + 7 + copy = list(nums) + + for query in queries: + li, ri, ki, vi = query + idx = li + + while idx <= ri: + copy[idx] = (copy[idx] * vi) % MOD + idx += ki + + xor_result = 0 + for num in copy: + xor_result ^= num + + return xor_result