Problem 2367 · Easy

Number of Arithmetic Triplets

Put the strictly increasing values in a hash set, then for each value check in constant time whether the two values above it at the fixed difference exist.

Open the interactive visualisation