190. Reverse Bits

Amazon’s - Reverse Bits

July 12, 2024 · 2 min · BeagleHQ

191. Number Of One Bits

Problem Statement in English Approach This is a subset of this problem. Solution in Python class Solution: def hammingWeight(self, n: int) -> int: ans = 0 while n > 0: if n&1 > 0: ans+=1 n = n >> 1 return ans Complexity Time: $O(1)$ Since we only process $32$ bits at most. Space: $O(1)$ Since we only store an integer variable. And we are done.

July 12, 2024 · 1 min · BeagleHQ

338. Counting Bits

Amazon’s - Counting Bits

July 12, 2024 · 2 min · BeagleHQ

1091. Shortest Path In Binary Matrix

Amazon’s - Shortest Path In Binary Matrix

July 1, 2024 · 5 min · BeagleHQ

994. Rotting Oranges

Amazon’s - Rotting Oranges

July 1, 2024 · 3 min · BeagleHQ