File tree Expand file tree Collapse file tree 5 files changed +10
-0
lines changed Expand file tree Collapse file tree 5 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1+ # TC: O(n), SC: O(n)
2+
13class Solution :
24 def countBits (self , n : int ) -> List [int ]:
35 answer = []
Original file line number Diff line number Diff line change 1+ # TC: O(n), SC: O(n)
2+
13from collections import defaultdict
24
35class Solution :
Original file line number Diff line number Diff line change 1+ # TC: O(n), SC: O(1)
2+
13class Solution :
24 def missingNumber (self , nums : List [int ]) -> int :
35 for i in range (len (nums )+ 1 ):
Original file line number Diff line number Diff line change 1+ # TC: O(1), SC: O(1)
2+
13class Solution :
24 def hammingWeight (self , n : int ) -> int :
35 return bin (n ).count ("1" )
Original file line number Diff line number Diff line change 1+ # TC: O(1), SC: O(1)
2+
13class Solution :
24 def reverseBits (self , n : int ) -> int :
35 return int (f"{ bin (n )[2 :]:0>32} " [::- 1 ], 2 )
You can’t perform that action at this time.
0 commit comments