values. Count the index triples i < j < k for which values[i], values[j] and values[k] are all pairwise different.values=[7, 3, 7, 5] → 2
Index triples (0, 1, 3), with values 7, 3, 5, and (1, 2, 3), with values 3, 7, 5, qualify. Triples with both 7s do not. The answer is 2.
values=[2, 2, 9, 9] → 0
There are only two distinct values, so no three can be pairwise different. The answer is 0.
values=[1, 2, 3, 4] → 4
values=[7, 3, 7, 5]
2
Run checks the first 3 tests in your browser. Submit checks all 75 tests on the server, hidden ones included.