Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cbf7e51

Browse files
Create Day 10.md
1 parent e6a4e43 commit cbf7e51

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

‎30 Days of Code HackerRank/Day 10.md‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Day 10: Binary Numbers
2+
3+
```
4+
num = int(input())
5+
6+
result = 0
7+
maximum = 0
8+
9+
while num > 0:
10+
if num % 2 == 1:
11+
result += 1
12+
if result > maximum:
13+
maximum = result
14+
15+
else:
16+
result = 0
17+
18+
num //= 2
19+
20+
print(maximum)
21+
22+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /