1009.cpp (176B)
1 class Solution { 2 public: 3 int bitwiseComplement(unsigned num) const { 4 if (num == 0) return 1; 5 return num ^ (0xFFFFFFFF >> std::countl_zero(num)); 6 } 7 };