Python - Without Lists, only hashmap - easy to understand - get() in O(1)
Most systems are read heavy and making assumption here we need fast get() compared to snap()\n\n\nclass SnapshotArray:\n\n    def __init__(self, length: int):\n
Most systems are read heavy and making assumption here we need fast `get()` compared to `snap()`\n\n```\nclass SnapshotArray:\n\n    def __init__(self, length: int):\n        self.hashmap = {0 : defaultdict(int)}\n        self.snapId = 0\n        \n    def set(self, index: int, val: int) -> None:\n        self.hashmap[self.snapId][index] = val\n\n    def snap(self) -> int:\n        self.snapId += 1\n        self.hashmap[self.snapId] = defaultdict(int)\n        \n        for index, val in self.hashmap[self.snapId - 1].items():\n            self.hashmap[self.snapId][index] = val\n        \n        return self.snapId - 1\n        \n    def get(self, index: int, snap_id: int) -> int:\n        return self.hashmap[snap_id][index]\n\n```\n`get()` in O(1)\n`snap()` in O(n) worst case
['Python', 'Python3']