[C++] Two maps
One map to keep for each index the last number.
The other map to keep for each number the positions. Since we the smallest positions for a number, we can keep
1. One map to keep for each index the last number.
2. The other map to keep for each number the positions. Since we the smallest positions for a number, we can keep the positions into a set
# Code
```cpp []
class NumberContainers {
public:
    unordered_map<int, int> positions;
    unordered_map<int, set<int>>number_indexes;
    NumberContainers() {
        
    }
    
    void change(int index, int number) {
        int old_number = positions.find(index) != positions.end() ? positions[index] : -1;
        if (old_number > 0) {
            number_indexes[old_number].erase(index);
            if (number_indexes[old_number].size() == 0)
                number_indexes.erase(old_number);
        }
        positions[index] = number;
        number_indexes[number].insert(index);    
    }
    
    int find(int number) {
        if (number_indexes.find(number) == number_indexes.end())
            return -1;
        return *number_indexes[number].begin();
    }
};

/**
 * Your NumberContainers object will be instantiated and called as such:
 * NumberContainers* obj = new NumberContainers();
 * obj->change(index,number);
 * int param_2 = obj->find(number);
 */
```
['C++']