6
def set(self, key: str, value: str, timestamp: int) -> None:7
if key not in self.dict:8
self.dict[key] = ([], [])9
self.dict[key][0].append(value)10
self.dict[key][1].append(timestamp)12
self.dict[key][0].append(value)13
self.dict[key][1].append(timestamp)15
def bsearch(self, nums, target):18
lastIndex = len(nums) - 121
mid = (beg + end) // 222
if target == nums[mid]:24
elif target < nums[mid]:26
elif target > nums[mid]:29
if target < nums[mid] and mid == 0:31
if target > nums[mid]:35
def get(self, key: str, timestamp: int) -> str:36
if key not in self.dict:39
index = self.bsearch(self.dict[key][1], timestamp)40
return self.dict[key][0][index] if 0 <= index < len(self.dict[key][0]) else ""43
# Your TimeMap object will be instantiated and called as such:45
# obj.set(key,value,timestamp)46
# param_2 = obj.get(key,timestamp)