Skip to content

Commit f4ce5b3

Browse files
authored
Added-cpp-solution (#101)
1 parent 5a2175e commit f4ce5b3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cpp/_41.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//Problem Link : https://leetcode.com/problems/first-missing-positive/
2+
3+
class Solution {
4+
public:
5+
int firstMissingPositive(vector<int>& nums) {
6+
for(int i=1;i<=nums.size()+1;i++){
7+
int d=count(nums.begin(),nums.end(),i);
8+
if(d==0) return i;
9+
}
10+
return 0;
11+
}
12+
};

0 commit comments

Comments
 (0)