Count of ascending triplets

131 Views Asked by At

I would like to solve a problem where in I am given a set of numbers and I have to find the count of all ascending triplets which can be derived from that set.

For eg:

[1,2,3,4]

the output would be 4 the solution would be

[1,2,3]
[1,3,4]
[2,3,4]
[1,2,4]

What can be the possible formula for that?

1

There are 1 best solutions below

0
On

The answer is simply $$\binom n3,$$ the number of ways to choose subsets of size 3 from $n $ numbers.