Stupid python SortedDict
I understand that in python, SortedDict is alter of TreeMap.\nBut why there isn\'t floorEntity or cellingEntity?  That makes me feel stupid.\nShould I use Java 
I understand that in python, SortedDict is alter of TreeMap.\nBut why there isn\'t floorEntity or cellingEntity?  That makes me feel stupid.\nShould I use Java next time when it comes? or I just use floorEntity anyway in python in real interview?\n\n```\nfrom sortedcontainers import SortedDict\nclass CountIntervals:\n\n    def __init__(self):\n        self.SD = SortedDict()\n        self.total = 0\n\t\t\n\t# from the right most of insert, merge all saved lefts that less than it, until no next left or no overlapping next left.\n\t# (reason we choose R to L is, R is natually \'hiden\' in treemap and not able to bisect.\n\t# E.g   we insert with right 8, so for 5 - 9, floor of 8 (5) is what we just need for merging from right to left.\n    def add(self, left: int, right: int) -> None:\n\t\t# Added 1 here, as I hope \'right\' means "the just next one of the current interval", it\'s easier with \'-\'.\n        right += 1 \n        while True:\n            i = self.SD.bisect_right(right) -1 # that bisect_right is inferior to floorEntity in TreeMap\n            if i < 0:\n                break\n            savedLeft, savedRight = self.SD.peekitem(i)\n            if savedRight < left:\n                break\n            \n            self.total -= (savedRight -savedLeft)\n            self.SD.popitem(i)\n            left = min(left, savedLeft)\n            right = max(right, savedRight)\n            \n        self.total += (right - left)\n        self.SD[left] = right\n\n    def count(self) -> int:\n        return self.total\n\t\t```
['Tree', 'Python']