My easy understand solution using moore algorithm
1.use Moore majority vote algorithm to find major num  that its frequency more than half.\n2.check the major num\u2018s frequency is more than threshhold.\n\n  
1.use Moore majority vote algorithm to find major num  that its frequency more than half.\n2.check the major num\u2018s frequency is more than threshhold.\n```\n    class MajorityChecker {\n        int[] arr;\n\n        public MajorityChecker(int[] arr) {\n            this.arr = arr;\n        }\n\n        /**\n         *  Moore majority vote algorithm\n         */\n        public int query(int left, int right, int threshold) {\n            // find major num \n            int major = arr[left];\n            int count = 1;\n\n            for (int i = left + 1; i <= right; i++) {\n                if (count == 0) {\n                    major = arr[i];\n                    count = 1;\n                } else if (major == arr[i]) {\n                    count++;\n                } else {\n                    count--;\n                }\n            }\n\n            //  check the major num\'s freq >= threshold\n            int realCount = 0;\n\n            for (int i = left; i <= right; i++) {\n                if (arr[i] == major) {\n                    realCount++;\n                }\n            }\n            if (realCount >= threshold) {\n                return major;\n            } else {\n                return -1;\n            }\n        }\n    }\n\n\n```
[]