diff --git a/smallest-missing-positive.py b/smallest-missing-positive.py new file mode 100644 index 0000000..b05fe73 --- /dev/null +++ b/smallest-missing-positive.py @@ -0,0 +1,16 @@ +class Solution(object): + def firstMissingPositive(self, nums): + """ + :type nums: List[int] + :rtype: int + """ + smallest = 1 + num_dict = {} + for num in nums: + num_dict[num] = 1 + while smallest < 2147483648: + if smallest not in num_dict: + return smallest + smallest += 1 + #return +