find missing element in list python code example
Example 1: how to return a missing element in python
def solution(A):
return [value for value in range(min(A),max(A)) if value not in A]
Example 2: how to return a missing element in python
def solution(A):
a = set(A)
for i, _ in enumerate(A, 1):
if i in a:
continue
return i
solution(A)
# 3