Easy solution C++ || Line by LIne Explained ||
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\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```\nclass Solution {\npublic:\n    class SegmentTree{\n    vector<long long>seg;\n    public:\n    SegmentTree(int n,int val){\n        seg.resize(4*n,val);\n    }\n    void build(vector<int>&nums,int ind,int low, int high){\n        if(low==high){\n            seg[ind] = nums[low];\n            return;\n        }\n        int mid = (low+high)/2;\n        build(nums,2*ind+1,low,mid);\n        build(nums,2*ind+2,mid+1,high);\n        seg[ind] = max(seg[2*ind+1],seg[2*ind+2]);\n    }\n    long long query(int ind,int low,int high,int l,int r){\n        // no overlap\n        if(l>high || r<low)return 0;\n\n        // complete overlap\n        if(low>=l && high<=r) return seg[ind];\n\n        // partial overlap\n        int mid = (low+high)/2;\n        long long left = query(2*ind+1,low,mid,l,r);\n        long long right = query(2*ind+2,mid+1,high,l,r);\n        return max(left,right);\n    }\n    // point update(replace value at index i with val)\n    void update(int ind,int low,int high,int i,int val){\n        if(low==high){\n            seg[ind] = val;\n            return;\n        }\n\n        int mid = (low+high)/2;\n        \n        if(mid>=i)update(2*ind+1,low,mid,i,val);\n        else update(2*ind+2,mid+1,high,i,val);\n\n        seg[ind] = max(seg[2*ind+1],seg[2*ind+2]);\n    }\n};\n    vector<bool> getResults(vector<vector<int>>& queries) {\n        vector<int>len(1e5,0);\n        set<int>obs;\n        obs.insert(0);\n        obs.insert(1e5-1);\n        len[1e5-1] = 1e5-1;\n        \n        SegmentTree seg(1e5,0);\n        seg.build(len,0,0,1e5-1);\n        vector<bool>ans;\n        for(auto i:queries){\n            if(i[0]==1){\n                int x = i[1];\n                auto it = obs.lower_bound(x);\n                int u = *it;\n                it--;\n                int l = *it;\n                len[u] = u-x;\n                len[x] = x-l;\n                obs.insert(x);\n                seg.update(0,0,1e5-1,u,len[u]);\n                seg.update(0,0,1e5-1,x,len[x]);\n                \n            }else{\n                int x = i[1],sz = i[2];\n                auto it = obs.lower_bound(x);\n                it--;\n                if(x-(*it)>=sz){\n                    ans.push_back(true);\n                    continue;\n                }\n                int end = *it;\n                int maxi = seg.query(0,0,1e5-1,0,end);\n                if(maxi>=sz){\n                    ans.push_back(true);\n                }else{\n                    ans.push_back(false);\n                }\n            }\n            \n        }\n        return ans;\n    }\n};\n```
['C++']