Bias against Python (again...)
Python gets TLE for this simple O(1) construction and O(n) query implementation:\n\nclass MajorityChecker(object):\n\n    def __init__(self, arr):\n        self
Python gets TLE for this simple O(1) construction and O(n) query implementation:\n```\nclass MajorityChecker(object):\n\n    def __init__(self, arr):\n        self.arr = arr\n\n    def query(self, left, right, threshold):\n        candidate = 0\n        count = 0\n        for i in range(left, right+1):\n            if count == 0:\n                candidate = self.arr[i]\n                count = 1\n            elif candidate == self.arr[i]:\n                count += 1\n            else:\n                count -= 1\n        \n        count = 0\n        for i in range(left, right+1):\n            if candidate == self.arr[i]:\n                count += 1\n        \n        if count >= threshold:\n            return candidate\n        return -1\n```\n\nBut it gets Accepted for Java\n```\nclass MajorityChecker {\n    int[] arr;\n        \n    public MajorityChecker(int[] arr) {\n        this.arr = arr;\n    }\n    \n    public int query(int left, int right, int threshold) {\n        int candidate = -1;\n        int count = 0;\n\n        for (int i = left; i <= right; i++) {\n            if (count == 0) {\n                candidate = arr[i];\n                count = 1;\n            } else if (candidate == arr[i]) {\n                count++;\n            } else {\n                count--;\n            }\n        }\n\n        count = 0;\n        for (int i = left; i <= right; i++) {\n            if (arr[i] == candidate){\n                count++;\n            }\n        }\n        if (count >= threshold){\n            return candidate;\n        } else {\n            return -1;\n        }\n    }\n}\n```\n\nand Accepted for Javascript\n```\nvar MajorityChecker = function(arr) {\n    this.arr = arr;\n};\n\nMajorityChecker.prototype.query = function(left, right, threshold) {\n    var candidate = 0\n    var count = 0\n    for (var i = left; i < right+1; i++) {\n        if (count == 0) {\n            candidate = this.arr[i];\n            count = 1;\n        }\n        else if (candidate == this.arr[i]) {\n            count += 1\n        }\n        else {\n            count -= 1\n        }\n    }\n    \n    count = 0\n    for (var i = left; i < right+1; i++) {\n        if (candidate == this.arr[i]) {\n            count += 1\n        }\n    }\n\n    if (count >= threshold) {\n        return candidate\n    }   \n    return -1\n};\n```\n\nand probably accepted for other languages...\n\nDear LeetCode Moderators: Please be consistent with TLE across different languages. If a O(1) constructor and O(n) query time should either be Accepted in all languages, or TLE in all languages. This is not the first time python time restrictions have been set more strict than other languages. Do you have hatred towards Python and you want us to compete in a different language?
['Python', 'Java', 'JavaScript']