Solved LeetCode Hard 3655 XOR After Range Multiplication Queries II

Solved today’s LeetCode Hard: 3655. XOR After Range Multiplication Queries II ✅ At first, it looked like a direct simulation problem. For each query: • start from l • jump by k • multiply by v Simple idea. But with n = 1e5 and queries = 1e5, that approach breaks very fast. So the real challenge was not implementing the updates… It was figuring out how to avoid doing them one by one. What I learned from this problem: The important observation was that each query updates indices in an arithmetic progression: l, l+k, l+2k ... That led to a much better approach: • Large k → process directly • Small k → group and batch efficiently That small observation completely changed the problem. What I liked about this one is that it didn’t need some magical trick. It just needed the right way of looking at the updates. Sometimes hard problems are less about advanced coding and more about seeing the structure early. Good problem. Nice learning. 🚀 Problem Link : https://lnkd.in/dHBq8t5z Solution : https://lnkd.in/dqMAvJca #LeetCode #Cpp #ProblemSolving #CodingJourney #CompetitiveProgramming

  • text

To view or add a comment, sign in

Explore content categories