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.
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.