30 Days. 30 Bit Manipulation Tips & Tricks.
For the next 30 days, I’ll share powerful bit hacks, clever tricks, uncommon patterns, and practical optimizations used in CP and real-world problem solving.
No boring theory.
Only useful, practical, and important concepts.
If CJP protest focus shifts from criticizing the BJP to promoting an anti-India narrative, it will lose credibility fast.
For an organization that presents itself as non-partisan, the overlap between its top leadership and AAP is hard to ignore.
30 Days. 30 Bit Manipulation Tips & Tricks.
For the next 30 days, I’ll share powerful bit hacks, clever tricks, uncommon patterns, and practical optimizations used in CP and real-world problem solving.
No boring theory.
Only useful, practical, and important concepts.
XOR Series Part-6: XOR Pattern for N integers
> XOR Pattern in 1 ^ 2 ^ 3 ^ … ^ n
> The XOR of all integers from 1 to n follows a 4-number repeating pattern:
- n % 4 = 0, then XOR (1 -> n) = n
- n % 4 = 1, then XOR (1 -> n) = 1
- n % 4 = 2, then XOR (1 -> n) = n + 1
- n % 4 = 3, then XOR (1 -> n) = 0
> Why does it repeat every 4?
- Look at table below
- Every 4 numbers, the last two bits repeat (01, 10, 11, 00).
- XOR affects bits independently.
- When you XOR sequentially, these repeated patterns in the least significant bits cause the overall XOR value to reset every 4 steps.
> Used in: Prefix XOR problems, Range XOR queries
30 Days. 30 Bit Manipulation Tips & Tricks.
For the next 30 days, I’ll share powerful bit hacks, clever tricks, uncommon patterns, and practical optimizations used in CP and real-world problem solving.
No boring theory.
Only useful, practical, and important concepts.
30 Days. 30 Bit Manipulation Tips & Tricks.
For the next 30 days, I’ll share powerful bit hacks, clever tricks, uncommon patterns, and practical optimizations used in CP and real-world problem solving.
No boring theory.
Only useful, practical, and important concepts.
XOR Series Part-6: XOR Pattern for N integers
> XOR Pattern in 1 ^ 2 ^ 3 ^ … ^ n
> The XOR of all integers from 1 to n follows a 4-number repeating pattern:
- n % 4 = 0, then XOR (1 -> n) = n
- n % 4 = 1, then XOR (1 -> n) = 1
- n % 4 = 2, then XOR (1 -> n) = n + 1
- n % 4 = 3, then XOR (1 -> n) = 0
> Why does it repeat every 4?
- Look at table below
- Every 4 numbers, the last two bits repeat (01, 10, 11, 00).
- XOR affects bits independently.
- When you XOR sequentially, these repeated patterns in the least significant bits cause the overall XOR value to reset every 4 steps.
> Used in: Prefix XOR problems, Range XOR queries
Using rain as an encryption algorithm.
The hard part isn't encryption, it's decryption.
You'd need the exact pattern of raindrops, their sizes, velocities, wind conditions, cloud movement, and atmospheric state at that moment.
If all of that could be measured and reproduced, rain might become a natural cryptographic key.
Maybe rain isn't random. Maybe it's just too complex for us to predict.
Looking to grow my tech circle on X
Into software engineering, Java, AI, startups, backend systems, or just building cool things? Let’s connect.
Drop what you’re building or learning 👇
@kernelKain