leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

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 };