fork download
  1. from itertools import count
  2.  
  3. def solution(A, N) -> int:
  4. for i in count(1):
  5. if i not in A:
  6. return i
  7.  
  8. assert solution([1, 3, 6, 4, 1, 2], 6) == 5
  9. assert solution([1, 2, 3], 3) == 4
  10. assert solution([-1, -3], 2) == 1
Success #stdin #stdout 0.02s 9388KB
stdin
Standard input is empty
stdout
Standard output is empty