Valid Triangle Number
Medium · Arrays & Strings · about 20 minutes
Asked at LinkedIn, Bloomberg, Amazon, Microsoft, Google.
Return the number of triplets (distinct indices) of nums that could be the side lengths of a triangle: the sum of any two sides is greater than the third.