Problem 1906 · Medium

Minimum Absolute Difference Queries

Prefix counts per value let each query list the values it contains in sorted order, so the smallest gap is between neighbours.

Open the interactive visualisation