Teacher has Enrollment number of all of the students in an List. But the list is unordered as a superhero Superman has taken the responsibility to find missing student. Help Superman to find the student.
Solution
t = int(input())
i = 0
while i < t:
n = int(input())
ar=list(map(int, input().split(' ')))
mi = min(ar)
s = sum(ar)
to = (n+1) * (2 * mi + n ) // 2
print (to-s)
i = i + 1
if you have any problem in this code, take a screen shot and contact with Rishabh Chaubey.
Input
2 4 2 5 6 4 8 88 80 82 81 84 86 85 87
Output
3 83
t = int(input())
i = 0
while i < t:
n = int(input())
ar=list(map(int, input().split(' ')))
mi = min(ar)
s = sum(ar)
to = (n+1) * (2 * mi + n ) // 2
print (to-s)
i = i + 1
if you have any problem in this code, take a screen shot and contact with Rishabh Chaubey.
Post a Comment