Valid Triangle Number

Given an integer array nums, return the number of index triplets (i, j, k) with i < j < k whose values can be the side lengths of a triangle with positive area.

Three lengths a, b, and c form a triangle exactly when every pair sums to more than the third value. After sorting a triple so that a <= b <= c, only a + b > c needs to be checked, because the other two inequalities follow from a <= b <= c.

Examples
Input: [8,10,6,7,6,26,30,3,9]
Output: 36
Hints

Valid Triangle Number

Given an integer array `nums`, return the number of index triplets `(i, j, k)` with `i < j < k` whose values can be the side lengths of a triangle with positive area.