Skip to content

Commit 5879570

Browse files
Added solution
1 parent d8eecf5 commit 5879570

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

find_first_missing_positive.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public:
3+
int firstMissingPositive(vector<int>& nums) {
4+
5+
int tofind = 1;
6+
while(1){
7+
if(find(nums.begin(), nums.end(), tofind) == nums.end())
8+
return tofind;
9+
tofind++;
10+
}
11+
return -1;
12+
}
13+
};

0 commit comments

Comments
 (0)