public class Solution {
public int firstMissingPositive(int[] A) {
HashSet<Integer> hash=new HashSet<Integer>();
int count=0;
int sum=0; for(int i:A)
{
if(i>0)
{
hash.add(i);
}
} int beg=1;
while(hash.contains(beg))
{
beg++; } return beg; }
}
V
public class Solution {
public int firstMissingPositive(int[] A) {
HashSet<Integer> hash=new HashSet<Integer>();
int count=0;
int sum=0; for(int i:A)
{
if(i>0)
{
hash.add(i);
}
} int beg=1;
while(hash.contains(beg))
{
beg++; } return beg; }
}
w Code