I'm not able to run the code for a while now what can I do to sort this error out.
AddressSanitizer: DEADLYSIGNAL ================================================================= ==32==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x000000383e8c bp 0x7ffc55bebe50 sp 0x7ffc55bebd20 T0) ==32==The signal is caused by a READ memory access. ==32==Hint: address points to the zero page. #3 0x7f2222e3982f (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) AddressSanitizer can not provide additional info. ==32==ABORTING
class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
int n=nums.size();
vector<int>ans(50);
for(int i=0; i<n; i++){
if(nums[i]<0) continue;
ans[nums[i]]++;
}
for(int i=1; i<n; i++){
if(ans[i]==0){
return i;
}
}
return n+1;
}
};