Skip to content

Commit b3bc8d8

Browse files
committed
Create README - LeetHub
source:2c230995811c1ec12cb02b44eabe503c84e422e0
1 parent 6b996b4 commit b3bc8d8

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<h2><a href="https://leetcode.com/problems/3sum-closest">16. 3Sum Closest</a></h2><h3>Medium</h3><hr><p>Given an integer array <code>nums</code> of length <code>n</code> and an integer <code>target</code>, find three integers at <strong>distinct indices</strong> in <code>nums</code> such that the sum is closest to <code>target</code>.</p>
2+
3+
<p>Return <em>the sum of the three integers</em>.</p>
4+
5+
<p>You may assume that each input would have exactly one solution.</p>
6+
7+
<p>&nbsp;</p>
8+
<p><strong class="example">Example 1:</strong></p>
9+
10+
<pre>
11+
<strong>Input:</strong> nums = [-1,2,1,-4], target = 1
12+
<strong>Output:</strong> 2
13+
<strong>Explanation:</strong> The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
14+
</pre>
15+
16+
<p><strong class="example">Example 2:</strong></p>
17+
18+
<pre>
19+
<strong>Input:</strong> nums = [0,0,0], target = 1
20+
<strong>Output:</strong> 0
21+
<strong>Explanation:</strong> The sum that is closest to the target is 0. (0 + 0 + 0 = 0).
22+
</pre>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Constraints:</strong></p>
26+
27+
<ul>
28+
<li><code>3 &lt;= nums.length &lt;= 500</code></li>
29+
<li><code>-1000 &lt;= nums[i] &lt;= 1000</code></li>
30+
<li><code>-10<sup>4</sup> &lt;= target &lt;= 10<sup>4</sup></code></li>
31+
</ul>

0 commit comments

Comments
 (0)