Segment tree + HashSet Solution
This code provides a way to handle and process dynamic range updates and queries. The segment tree structure allows efficient max-range queries and point update
This code provides a way to handle and process dynamic range updates and queries. The segment tree structure allows efficient max-range queries and point updates within a range, which is useful in handling large sets of queries with specific constraints.\n\n# Code\n```java []\nclass Solution {\n\n    class node {\n        int val;\n        node left, right;\n        public node(int val) {\n            this.val = val;\n        }\n    }\n\n    class segmenttree {\n\n        private node root;\n        private int size;\n\n        public segmenttree(int n){\n            root = create(0, n);\n            size = n;\n        }\n\n        public void update(int i, int v) {\n            update(root, 0, size, i, v);\n        }\n\n        public int search(int i) {\n            return search(0, i, 0, size, root);\n        }\n\n        public int search(int  i, int j, int s, int e, node root) {\n            if(s >= i && j >= e) {\n                return root.val;\n            }\n            if(s > j || e < i) {\n                return 0;\n            }\n            int mid = (s+e)/2;\n            int left = search(i, j, s, mid, root.left);\n            int right = search(i,j, mid+1, e, root.right);\n            return Math.max(left, right);\n        }\n\n        public void update(node root, int s, int e, int i, int v) {\n            if(root == null || e < i || s > i) {\n                return;\n            }\n            if(s == e && s == i) {\n                root.val = v;\n                return;\n            }\n            int mid = (s+e)/2;\n            update(root.left, s, mid, i, v);\n            update(root.right, mid+1, e, i, v);\n            root.val = Math.max(root.left != null?root.left.val:0, root.right != null?root.right.val:0);\n        }\n\n        public node create(int s, int e) {\n            if(s == e) {\n                return new node(0);\n            }\n            int mid = (s+e)/2;\n            node temp = new node(0);\n            temp.left = create(s, mid);\n            temp.right = create(mid+1, e);\n            return temp;\n        }\n    }\n\n\n    public List<Boolean> getResults(int[][] queries) {\n        segmenttree tree = new segmenttree(50001);\n        List<Boolean> result = new LinkedList();\n        TreeSet<Integer> set = new TreeSet();\n        set.add(0);\n        set.add(50001);\n        tree.update(50001, 50001);\n        for(int[] q: queries) {\n            if(q[0] == 1) {\n                set.add(q[1]);\n                tree.update(q[1], q[1] - set.lower(q[1]));\n                tree.update(set.higher(q[1]), set.higher(q[1]) - q[1]);\n            } else {\n               int val = tree.search(set.lower(q[1])); \n               boolean check1 =  val >= q[2];\n               boolean check2 = q[1] - set.lower(q[1]) >= q[2];\n               result.add(check1 || check2);\n            }\n        }\n        return result;\n    }\n}\n```
['Java']