We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 279a47c commit d11a4f2Copy full SHA for d11a4f2
Introductory-Problems/Missing-Number.py
@@ -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)
Introductory-Problems/Repetitions.py
@@ -0,0 +1,14 @@
+sq = [i for i in input().split()] # ACCCGTC
+s = set([sq[0]])
+max_val = 1
+cnt = 0
+for i in range(1, len(sq)):
+ if len(s) == 1:
+ cnt += 1
+ max_val = max(max_val, cnt)
+ s.add(sq[i])
+ else:
+ s.pop(0)
+ cnt = 0
+print(max_val) # wrong ans
0 commit comments