2220. Minimum Bit Flips to Convert Number 發表於 2023-02-13 | 分類於 leetcode problemsolution12345678910111213class Solution {public: int minBitFlips(int start, int goal) { int n = start^goal, count = 0; // count one while(n){ n &=(n-1); count++; } return count; }}; analysis time complexity O(n) space complexity O(1)