Count the number of possible triangles

You are given an array of positive integers, where each value is the length of a candidate side. Count how many ways you can pick three different positions i < j < k so that the three chosen lengths can form a non-degenerate (strictly positive area) triangle.

A triple of side lengths (a, b, c) forms a non-degenerate triangle exactly when the sum of the two smaller sides is strictly greater than the largest side. After sorting the triple so that a <= b <= c, the condition is a + b > c. Equality does not count: 1, 2, 3 is a flat segment, not a triangle.

Positions matter, not values. If the same length appears at two different indices, the two indices are different choices. The order of the input array has no effect on the answer.

The function signature is solve(arg1), where arg1 is the array of side lengths. Return the number of valid index triples.

Examples
Input: [2,3,4]
Output: 1
Hints

Count the number of possible triangles

You are given an array of positive integers, where each value is the length of a candidate side. Count how many ways you can pick three different positions `i < j < k` so that the three chosen lengths can form a non-degenerate (strictly positive area) triangle.