Skip to content

Commit d11a4f2

Browse files
committed
repair repetitions
1 parent 279a47c commit d11a4f2

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
n = int(input())
2+
arr = list(map(int, input().split()))
3+
4+
5+
# run time error
6+
#
7+
# for i in range(n-1):
8+
# if i+1 not in arr:
9+
# print(i+1)
10+
# break
11+
12+
all_sum = sum(arr)
13+
# print(all_sum)
14+
ideal_sum = n * (n + 1) // 2
15+
# print(ideal_sum)
16+
ans = ideal_sum - all_sum
17+
print(ans)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
sq = [i for i in input().split()] # ACCCGTC
2+
s = set([sq[0]])
3+
max_val = 1
4+
cnt = 0
5+
for i in range(1, len(sq)):
6+
if len(s) == 1:
7+
cnt += 1
8+
max_val = max(max_val, cnt)
9+
s.add(sq[i])
10+
else:
11+
s.pop(0)
12+
cnt = 0
13+
print(max_val) # wrong ans
14+

0 commit comments

Comments
 (0)