Created
April 6, 2022 23:13
-
-
Save aaronshaver/520887c47947dec4240358a7f611ea65 to your computer and use it in GitHub Desktop.
bit_count() function new in Python 3.10 counts true bits in a binary number
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-bit-flips-to-convert-number/ | |
def minBitFlips(self, start: int, goal: int) -> int: | |
return (start ^ goal).bit_count() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment