We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5a2175e commit f4ce5b3Copy full SHA for f4ce5b3
cpp/_41.cpp
@@ -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