diff --git a/cpp/_41.cpp b/cpp/_41.cpp new file mode 100644 index 0000000000..892d77686a --- /dev/null +++ b/cpp/_41.cpp @@ -0,0 +1,12 @@ +//Problem Link : https://leetcode.com/problems/first-missing-positive/ + +class Solution { +public: + int firstMissingPositive(vector& nums) { + for(int i=1;i<=nums.size()+1;i++){ + int d=count(nums.begin(),nums.end(),i); + if(d==0) return i; + } + return 0; + } +}; \ No newline at end of file