maintain a rolling max
Intuition\n Describe your first thoughts on how to solve this problem. \nI tried to maintain a rolling max, not sure how to make it better without seg tree \n# 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nI tried to maintain a rolling max, not sure how to make it better without seg tree \n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def getResults(self, queries: List[List[int]]) -> List[bool]:\n\n        obs=[]\n        gaps=[inf]\n        rolling_max=[inf]\n        result=[]\n        for q in queries:\n            if q[0]==1:\n                ind=bisect.bisect_left(obs,q[1])\n                gap_splitted=gaps[ind]\n                gaps[ind:ind+1]=[q[1]-(obs[ind-1] if ind>=1 else 0),(obs[ind] if ind != len(obs) else inf) -q[1]]\n                rolling_max[ind:ind+1]=[None,None]\n                for i in range(ind,len(rolling_max)):\n                    old_val=rolling_max[i]\n                    rolling_max[i]=max(rolling_max[i-1] if i>=1 else 0,gaps[i])\n                    if i>=ind+2 and old_val==rolling_max[i]:\n                        break\n                bisect.insort_left(obs,q[1])\n\n            elif q[0]==2:\n                x=q[1]\n                sz=q[2]\n                ind=bisect_right(obs,x)\n                #available_gaps=gaps[0:ind]\n                max_available=max([rolling_max[ind-1] if ind>=1 else 0]+[x-(obs[ind-1] if ind>=1 else 0)])\n                result.append(max_available>=sz)\n        return result\n```
['Python3']