Skip to content

Latest commit

 

History

History
14 lines (9 loc) · 502 Bytes

File metadata and controls

14 lines (9 loc) · 502 Bytes
  • Difficulty: #easy
  • Category: #ProblemSolvingBasic #BitManipulation

Using bitwise operations

The bitwise NOT operator (~) flips all bits of the number.

The & 0xFFFFFFFF ensures that we only keep the last 32 bits, effectively simulating a 32-bit unsigned integer.

This is a more efficient and concise way to achieve the same result as the original code, without needing to convert to binary strings.