Problem 3636 · Hard

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.

Open the interactive visualisation