MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / missing_num

Function missing_num

CSES_Problems/Missing Number/solution.py:1–6  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

1def missing_num(n):
2 n=sorted(n) # shuffling the items of n in a sorted manner
3 n.append(0) #adding the number 0 at the end for checking purpose
4 for i in range(1,len(n)+1):
5 if i!=n[i-1]: # checking for the missing number
6 return i # returning the missing number
7
8input()
9n = list(map(int, input().split(" "))) # Splitting the input line in a list

Callers 1

solution.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected