Posted on July 9, 2021 Description Submission class Solution { public: int findComplement(int num) { int ret = 0; bool start = false; for(int i = 31; i >= 0; --i) { if((num >> i) & 1) start = true; if(start && ((num>>i) & 1) == 0) ret += (1 << i); } return ret; } }; By Bill0412 Easy LeetCode