Last active
November 30, 2023 16:05
-
-
Save statulr/c3205c2ec873f777b913b18768542ebd to your computer and use it in GitHub Desktop.
leetcode2148 (Faster than 100%)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://leetcode.com/problems/minimum-one-bit-operations-to-make-integers-zero/submissions/1109638560/ | |
#include <stdio.h> | |
unsigned int minimumOneBitOperations(unsigned int n) { | |
uint32_t result = 0; | |
while (n) { | |
result ^= n; | |
n >>= 1; | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment