Class Solution
java.lang.Object
g0601_0700.s0611_valid_triangle_number.Solution
611 - Valid Triangle Number.<p>Medium</p>
<p>Given an integer array <code>nums</code>, return <em>the number of triplets chosen from the array that can make triangles if we take them as side lengths of a triangle</em>.</p>
<p><strong>Example 1:</strong></p>
<p><strong>Input:</strong> nums = [2,2,3,4]</p>
<p><strong>Output:</strong> 3</p>
<p><strong>Explanation:</strong> Valid combinations are: 2,3,4 (using the first 2) 2,3,4 (using the second 2) 2,2,3</p>
<p><strong>Example 2:</strong></p>
<p><strong>Input:</strong> nums = [4,2,3,4]</p>
<p><strong>Output:</strong> 4</p>
<p><strong>Constraints:</strong></p>
<ul>
<li><code>1 <= nums.length <= 1000</code></li>
<li><code>0 <= nums[i] <= 1000</code></li>
</ul>
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Solution
public Solution()
-
-
Method Details
-
triangleNumber
public int triangleNumber(int[] nums)
-