Missing Numbers

  • + 0 comments

    c++

    vector<int> missingNumbers(vector<int> arr, vector<int> brr) {
        set<int> s;
    
        sort(arr.begin(), arr.end());
        sort(brr.begin(), brr.end());
    
        set_difference(brr.cbegin(),brr.cend(), arr.cbegin(),arr.cend(), inserter(s, s.begin()));
        
        return vector<int>(s.cbegin(), s.cend());
    }