1.times = [100, 130, 130, 130, 220]. What do bisect_left(times, 130) and bisect_right(times, 130) return?
2.A binary search uses lo, hi = 0, len(a) and while lo < hi, with mid = (lo + hi) // 2. Someone writes lo = mid in the branch where a[mid] is below the target. What happens?
3.A store keeps each key's change times sorted in times and the values in values. A read does values[bisect_right(times, t) - 1]. What does it return for a t before the key's first change?
4.A log of (key, time, value) arrives out of order, and two changes can share a time, in which case the later one wins. Values can be dicts. How should you sort it before building each key's history?
5.Which of these questions can you answer with a binary search on the answer?
6.A store with 10,000 keys takes a snapshot after every 100 changes. One design copies every key's current value at each snapshot. The other keeps, per key, a list of (snapshots taken so far, value) after each change, and a snapshot only adds 1 to a counter. What does a snapshot cost in each?