Python (Simple Maths)
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 MajorityChecker:\n    def __init__(self, arr):\n        self.arr = arr\n        self.dict1 = defaultdict(list)\n\n        for i,x in enumerate(arr):\n            self.dict1[x].append(i)\n\n    def query(self, left, right, threshold):\n        for _ in range(10):\n            k = random.randint(left,right)\n            res = self.arr[k]\n            lo = bisect.bisect_left(self.dict1[res],left)\n            hi = bisect.bisect_right(self.dict1[res],right)\n            if hi-lo >= threshold: return res\n\n        return -1\n\n\n\n\n\n        \n\n```
['Python3']