Implement SortedStore that keeps keys sorted (using bisect, not re-sorting) and supports:
put(key, value) (overwrites existing), get(key, default=None), delete(key) (no error if missing)range(lo, hi): list of (key, value) with lo <= key < hi, in key orderfloor(key): the largest stored key <= key, or None; ceiling(key): the smallest >= key, or None__len__Unlock this and every premium problem across all tracks — plus hidden-test grading, advanced AI engineering modules and new content every week.
Start 7-day free trial