From 8cf52b899a76d491b7169c4ae138d6a75e7bbf7a Mon Sep 17 00:00:00 2001 From: PraneshASP Date: Thu, 1 Oct 2020 11:05:01 +0530 Subject: [PATCH] Added-cpp-solution --- cpp/_41.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cpp/_41.cpp 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