Skip to content

Commit fda0256

Browse files
Add files via upload
1 parent 8c80ed5 commit fda0256

File tree

3 files changed

+65
-0
lines changed

3 files changed

+65
-0
lines changed

3. Longest Substring.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Mon Sep 7 22:46:33 2020
4+
5+
@author: 91842
6+
"""
7+
s = input()
8+
m = 0
9+
d = []
10+
for char in s:
11+
if char in d:
12+
d = d[d.index(char)+1:]
13+
14+
15+
d.append(char)
16+
print(d)
17+
18+
m = max(m, len(d))
19+
20+
print(m)

5. Reverse integer 1.0.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Tue Sep 8 20:33:51 2020
4+
5+
@author: 91842
6+
"""
7+
8+
a = int(input())
9+
10+
c = a
11+
12+
if a<0:
13+
a=-a
14+
15+
d = list(str(a))
16+
b = []
17+
i = len(d)-1
18+
19+
while i>=0:
20+
b.append(d[i])
21+
i-=1
22+
23+
ans = "".join(map(str,b))
24+
ans = int(ans)
25+
26+
if c<0:
27+
ans= -ans
28+
29+
if ans > (2**31-1) or ans<-(2**31):
30+
print(0)
31+
else:
32+
print(ans)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
Created on Wed Sep 9 23:06:38 2020
4+
5+
@author: 91842
6+
"""
7+
hour,minutes = [int(i) for i in input().split()]
8+
9+
hour=hour+minutes/60
10+
minutes = minutes/5
11+
12+
ans = (max(hour,minutes)-min(hour,minutes))*30
13+
print(min(ans,360-ans))

0 commit comments

Comments
 (0)