Given an array and a triple, find the number of occurrences of the triple as a subsequence in the give array.
For example,
array [1, 2, 2, 1, 2, 1, 2, 3], triple [1, 1, 2]
this should return 4, because we have
(0, 3, 4), (0, 3, 6), (0, 5, 6), (3, 5, 6) those subsequence can form the triple [1, 1, 2]
Can we do this better than O(n ^ 3) ?