From fd0fae762f98227a31cdac14c878245aec0ebd20 Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Wed, 2 Sep 2026 22:29:49 +0900 Subject: [PATCH] Create 3827. Count Monobit Integers.py --- .../3827. Count Monobit Integers.py" | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 "leetcode3/\354\265\234\354\233\220\354\244\200/3827. Count Monobit Integers.py" diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/3827. Count Monobit Integers.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/3827. Count Monobit Integers.py" new file mode 100644 index 00000000..97c60762 --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/3827. Count Monobit Integers.py" @@ -0,0 +1,17 @@ +class Solution: + def countMonobit(self, n: int) -> int: + def is_monobit(num): + binary = bin(num)[2:] + base = binary[0] + for b in binary: + if b != base: + return False + return True + + ans = 0 + for i in range(n+1): + ans += is_monobit(i) + return ans + + +