Threshold Majority Queries
Each query names a subarray and a threshold. Answer with the value that occurs most often in that subarray, taking the smaller value on a tie, provided it occurs at least threshold times; otherwise answer -1.
Each query names a subarray and a threshold. Answer with the value that occurs most often in that subarray, taking the smaller value on a tie, provided it occurs at least threshold times; otherwise answer -1.