mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-06 07:51:41 +08:00
update
This commit is contained in:
28
leetcode/problem/valid-triangle-number.html
Normal file
28
leetcode/problem/valid-triangle-number.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<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> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [2,2,3,4]
|
||||
<strong>Output:</strong> 3
|
||||
<strong>Explanation:</strong> Valid combinations are:
|
||||
2,3,4 (using the first 2)
|
||||
2,3,4 (using the second 2)
|
||||
2,2,3
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> nums = [4,2,3,4]
|
||||
<strong>Output:</strong> 4
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= nums.length <= 1000</code></li>
|
||||
<li><code>0 <= nums[i] <= 1000</code></li>
|
||||
</ul>
|
Reference in New Issue
Block a user