Valid Triangle Number
Problem statement
Return the number of index triples i < j < k whose three nonnegative values can form the side lengths of a nondegenerate triangle.
Function
triangleNumber(nums: int[]) → intExamples
Example 1
nums = [2,2,3,4]return = 3The valid side triples are (2,3,4) twice by index and (2,2,3).
Constraints
0 <= nums.length <= 1000.0 <= nums[i] <= 1000.