using hashmap of priorityqueue(min heap)
\n     class NumberContainers {\n        Map> m;\n        Map m1;\n    public NumberContainers() {\n        m=new HashMap<>();\n        m1=new HashMap<>();\n   
\n     class NumberContainers {\n        Map<Integer,PriorityQueue<Integer>> m;\n        Map<Integer,Integer> m1;\n    public NumberContainers() {\n        m=new HashMap<>();\n        m1=new HashMap<>();\n    }\n    \n    public void change(int index, int number) {\n        m1.put(index,number);\n        if(!m.containsKey(number)){\n            m.put(number,new PriorityQueue<>());\n        }\n        m.get(number).add(index);\n        \n    }\n    \n    public int find(int number) {\n        if(!m.containsKey(number))return -1;\n        \n            PriorityQueue<Integer> q=m.get(number);\n        \n            int z=-1;\n            while(!q.isEmpty()){\n                int t1=q.peek();\n           //     System.out.print(t1+" ");\n                if(number==m1.get(t1)){\n                    z=t1;\n                    break;\n                }\n                else{\n                    q.poll();\n                }\n            }\n        return z;\n    }\n}
['Heap (Priority Queue)']