Two map with heap. No SortedList. Faster than 95%
SortedList is great until you find it is not available in some OA or interviews. Here I use two map with heap.\n\n# Code\n\nclass NumberContainers:\n\n    def _
SortedList is great until you find it is not available in some OA or interviews. Here I use two map with heap.\n\n# Code\n```\nclass NumberContainers:\n\n    def __init__(self):\n        self.map = {} # number, heap[index]\n        self.index_to_number = {} # index, number\n\n    def change(self, index: int, number: int) -> None:\n        if number not in self.map:\n            self.map[number] = []\n\n        heapq.heappush(self.map[number], index)\n        self.index_to_number[index] = number\n\n    def find(self, number: int) -> int:\n        if number not in self.map:\n            return -1\n\n        heap = self.map[number]\n        while heap:\n            index = heapq.heappop(heap)\n            if self.index_to_number[index] == number:\n                heapq.heappush(heap, index)\n                return index\n            \n        return -1\n\n\n# Your NumberContainers object will be instantiated and called as such:\n# obj = NumberContainers()\n# obj.change(index,number)\n# param_2 = obj.find(number)\n```
['Python3']