Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 865cc7e

Browse filesBrowse files
committed
update: 016
1 parent 193374f commit 865cc7e
Copy full SHA for 865cc7e

File tree

1 file changed

+1
-1
lines changed
Filter options

1 file changed

+1
-1
lines changed

‎note/016/README.md

Copy file name to clipboardExpand all lines: note/016/README.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Given an array *S* of *n* integers, find three integers in *S* such that the sum
1515

1616
## 思路
1717

18-
这道题和 [3Sum][015] 的思路基本一样,先对数组进行排序,然后遍历这个排序数组,用两个指针分别指向当前元素的下一个和数组尾部,判断三者的和与 `target` 的差值来移动两个指针,并更新其结果,当然,如果三者的和直接与 `target` 值相同,那么返回 `target` 结果即可。
18+
题意是让你从数组中找出最接近 `target` 的三个数的和,该题和 [3Sum][015] 的思路基本一样,先对数组进行排序,然后遍历这个排序数组,用两个指针分别指向当前元素的下一个和数组尾部,判断三者的和与 `target` 的差值来移动两个指针,并更新其结果,当然,如果三者的和直接与 `target` 值相同,那么返回 `target` 结果即可。
1919

2020
```java
2121
public class Solution {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.