Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def solution(a):
- the_set = set()
- for element in a:
- if element > 0:
- the_set.add(element)
- if len(the_set) < 1:
- return 1
- for element in range(0, len(the_set)):
- if element + 1 not in the_set:
- return element + 1
- return len(the_set) + 1
- assert solution([1, 3, 6, 4, 1, 2]) == 5
- assert solution([1, 2, 3]) == 4
- assert solution([-1, -3]) == 1
- print("Ran Successfully")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement