Vijay Pagare

DSA - 2 new (Bit Manipulation Fundamentals)


190. Reverse Bits

Insight: Requires strong understanding of bitwise operators and shifts; iterate through 32 bits, extract last bit using AND, shift result left, and append

Comment: Couldn’t solve independently; highlighted a gap in bit manipulation fluency, especially combining shifts and bit extraction correctly

191. Number of 1 Bits

Insight: Check last bit using AND with 1, increment count if set, then right shift to process remaining bits

Comment: After revising bitwise fundamentals, was able to solve comfortably.


Bitwise Operations:

OperatorNameDescription
&ANDSets each bit to 1 if both bits are 1
|ORSets each bit to 1 if at least one bit is 1
^XORSets each bit to 1 if exactly one bit is 1
~NOTInverts all the bits
«Left ShiftShifts left by pushing zeros from the right
»Signed Right ShiftShifts right while preserving the sign bit
»>Unsigned Right ShiftShifts right by pushing zeros from the left

Note — Bitwise operations are not in-place; always assign the result.

Reflection

Clear signal that bit manipulation needs dedicated practice. These problems are less about patterns and more about comfort with low-level operations. Once the mental model clicks, they become mechanical.

Progress on Dissertation:

Worked on incorporating examiner feedback — To include input modalities and output scoring + validation logic. Will share the report soon.