C# Solution
\npublic class MajorityChecker \n{\n\tDictionary<int, List<int>> indexMap;\n    public MajorityChecker(int[] arr)\n\t{\n         indexMap = new Dictionary<int, 
```\npublic class MajorityChecker \n{\n\tDictionary<int, List<int>> indexMap;\n    public MajorityChecker(int[] arr)\n\t{\n         indexMap = new Dictionary<int, List<int>>();\n\t\t for(int i = 0; i < arr.Length; i++)\n\t\t {\n\t\t \tvar num = arr[i];\n\t\t\tif(!indexMap.ContainsKey(num)) \n\t\t\t\tindexMap[num] = new List<int>();\n\t\t\tindexMap[num].Add(i);\n\t\t }\n    }\n\t\n    public int Query(int left, int right, int threshold) \n\t{\n\t\tforeach(var kvp in indexMap)\n\t\t{\n\t\t\tif(kvp.Value.Count >= threshold)\n\t\t\t{\n\t\t\t\tvar list = kvp.Value;\n\t\t\t\tint start = list.BinarySearch(left), end = list.BinarySearch(right);\n\t\t\t\tif(start < 0) start = ~start;\n\t\t\t\tif(end < 0) end = ~end - 1;\n\t\t\t\tif(end - start + 1 >= threshold)\n\t\t\t\t\treturn kvp.Key;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn -1;\n    }\n}\n```
[]