Problem 2670 · Easy

Find the Distinct Difference Array

Compute the distinct counts of every prefix and suffix, then subtract them at each index.

Open the interactive visualisation