1
2
3
4
5
6
7
|
class Solution:
def numberOfMatches(self, n: int) -> int:
ans=0
while n>1:
ans+=n//2+n%2
n//=2
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
백준 SASA 모형을 만들어보자 (0) | 2022.03.08 |
---|---|
leetcode 1816. Truncate Sentence (0) | 2022.03.07 |
백준 9316 Hello Judge (0) | 2022.03.07 |
Leetcode 2006. Count Number of Pairs With Absolute Difference K (0) | 2022.03.07 |
leetcode 2194. Cells in a Range on an Excel Sheet (0) | 2022.03.07 |
댓글