Skip to content

Commit f548cf4

Browse files
committed
feat: week8 - reverse bits
1 parent c2224fc commit f548cf4

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

โ€Žreverse-bits/Seoya0512.pyโ€Ž

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
'''
2+
ํŒŒ์ด์ฌ ๋‚ด์žฅ ํ•จ์ˆ˜ ์‚ฌ์šฉ
3+
- format ํ•จ์ˆ˜๋กœ ์ •์ˆ˜ n์„ 32๋น„ํŠธ ์ด์ง„์ˆ˜๋กœ ๋ณ€ํ™˜ํ•œ ๋’ค, ์—ญ์ˆ˜๋กœ ๋’ค์ง‘์–ด ๋‹ค์‹œ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
4+
5+
Time Complexity: O(1)
6+
Space Complexity: O(1)
7+
'''
8+
class Solution:
9+
def reverseBits(self, n: int) -> int:
10+
return int(format(n,'032b')[::-1], 2)

0 commit comments

Comments
ย (0)