Bits That Changed My CP Thinking — (Beginner Part)

Правка en6, от 0t0infinity, 2026-05-19 20:40:01

Bitwise Operations was one of the most confusing topics for me at first. But once I started understanding how bits actually work, many CP problems suddenly became much easier to think about and optimize.

This blog is the result of a full day of grinding, where I tried to organize everything I know about bitwise tricks into a clear and structured form — from the basics to useful CP patterns. I tried to keep everything as simple and beginner-friendly as possible so that anyone can understand the core idea behind each trick instead of memorizing formulas. If even one trick from this blog helps someone solve a problem faster or understand bits more clearly, then this effort feels truly meaningful for me.

And finally, I want to express my deepest gratitude to Raha Ahmed for being The Strongest support in my CP journey. Her constant encouragement, belief and presence have played a huge role in shaping my progress and I’m truly grateful for everything she has done.


The Basics for Beginners :


Basics All - (click here)

Trick 1 : Check Odd or Even Number


Explanation - (click here)

Trick 2 : Check The k-th bit


Explanation - (click here)

Trick 3 : iterate Through All Bits


Explanation - (click here)

Trick 4 : Count Set bits / On bits


Explanation - (click here)

Trick 5 : Set and Clear The k-th bit


Explanation - (click here)

Trick 6 : Toggle The k-th bit


Explanation - (click here)

Trick 7 : Multiply and Divide by 2


Explanation - (click here)

Trick 8 : Remove The Lowest Set bit


Explanation - (click here)

Trick 9 : Get The Lowest Set bit


Explanation - (click here)

Trick 10 : Count Trailing and Leading Zeros


Explanation - (click here)

Trick 11 : Find The Highest Set Bit Position


Explanation - (click here)

Trick 12 : Check whether A Number is Power of 2


Explanation - (click here)

Trick 13 : Find The Unique Element using XOR


Explanation - (click here)

Trick 14 : Generate All Subsets using Bitmask


Explanation - (click here)

* Part 2 (Intermediate Level) coming very soon !... RS1630


История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en7 Английский 0t0infinity 2026-05-21 11:56:23 85 Tiny change: 'ry/153864) - **Regards :-** `RS1630`\n\n--- \n' -> 'ry/153864)\n\n--- \n'
en6 Английский 0t0infinity 2026-05-19 20:40:01 1 Tiny change: 'on !... RS-1630\n\n--' -> 'on !... RS1630\n\n--'
en5 Английский 0t0infinity 2026-05-16 21:17:14 1 Tiny change: 'on !... RS1630\n\n--' -> 'on !... RS-1630\n\n--'
en4 Английский 0t0infinity 2026-05-16 11:49:41 1 Tiny change: '--- \n\n## * Part ' -> '--- \n\n### * Part '
en3 Английский 0t0infinity 2026-05-16 11:48:17 69 Tiny change: '--- \n\n### Part 2 ' -> '--- \n\n## Part 2 '
en2 Английский 0t0infinity 2026-05-10 18:16:53 17 Tiny change: 'st supports in my CP ' -> 'st support in my CP '
en1 Английский 0t0infinity 2026-05-08 19:38:38 17798 Initial revision (published)