message: Update snapshot-array.py
diff: @@ -12,7 +12,7 @@ class SnapshotArray(object):
  """
  :type length: int
  """
  - self.__A = collections.defaultdict(lambda: [(-1, 0)])
  + self.__A = collections.defaultdict(lambda: [[0, 0]])
  self.__snap_id = 0
  @@ -22,7 +22,10 @@ class SnapshotArray(object):
  :type val: int
  :rtype: None
  """
  - self.__A[index].append((self.__snap_id, val))
  + if self.__A[index][-1][0] == self.__snap_id:
  + self.__A[index][-1][1] = val
  + else:
  + self.__A[index].append([self.__snap_id, val])
  def snap(self):
  @@ -39,5 +42,5 @@ class SnapshotArray(object):
  :type snap_id: int
  :rtype: int
  """
  - i = bisect.bisect_right(self.__A[index], (snap_id+1, 0)) - 1
  + i = bisect.bisect_left(self.__A[index], [snap_id+1, float("-inf")]) - 1
  return self.__A[index][i][1]
  