Trivial Java Solution with 2 Hash maps
Intuition\n\nOne map is used to keep a track of number and their index and second hashmap is used to keep track which number is associated with which index.\n\n
**Intuition**\n\nOne map is used to keep a track of number and their index and second hashmap is used to keep track which number is associated with which index.\n\nUsed TreeSet to sort the associated index of a number and get smalled among them in O(1) time.\n\n```\nclass NumberContainers {\n\n    \n    HashMap<Integer, Integer> idxMap;\n    HashMap<Integer, TreeSet<Integer>> idxSet;\n\n    public NumberContainers() {\n        this.idxMap = new HashMap<>();\n        this.idxSet = new HashMap<>();\n    }\n    \n    public void change(int index, int number) {\n        \n        // If the element is present remove its idx from its set \n        if(this.idxMap.containsKey(index)){\n            if(this.idxMap.get(index) == number){\n                return;\n            }else{\n                TreeSet<Integer> temp = this.idxSet.get(this.idxMap.get(index));\n                temp.remove(index);\n            }\n        }\n        \n        // Insert the element int the map\n        this.idxMap.put(index, number);\n        \n        // Insert its idx in it\'s set\n        if(this.idxSet.containsKey(number)){\n            this.idxSet.get(number).add(index);\n        }else{\n            TreeSet<Integer> temp = new TreeSet<>();\n            temp.add(index);\n            this.idxSet.put(number,temp);\n        }\n        \n        return;\n    }\n    \n    public int find(int number) {\n        if(!this.idxSet.containsKey(number)){\n            return -1;\n        }else{\n            TreeSet<Integer> temp =  this.idxSet.get(number);\n            if(temp.size() == 0){\n                return -1;\n            }else{\n                return temp.first();\n            }\n        }\n    }\n}\n```
['Java']