vendredi 28 février 2020

reference binding to null pointer of type 'int' (stl_iterator.h)

can someone help me to solve this error

Line 786: Char 17: runtime error: reference binding to null pointer of type 'int' (stl_iterator.h)

class Solution {
public:
    vector<int> findDisappearedNumbers(vector<int>& nums) {
        vector<int>result;
        sort(nums.begin(),nums.end());
        int p=1;
        int minel=*min_element(nums.begin(),nums.end());
        int maxa=*max_element(nums.begin(),nums.end());
        for(int64_t i=minel;i<=maxa;i++)
        {
            int c=count(nums.begin(),nums.end(),i);
            if(c==0)
            {
                result.push_back(i);
            }
        }
        return result;
    }
};

Aucun commentaire:

Enregistrer un commentaire