Nine Chapters count judges Net-original website
http://www.jiuzhang.com/problem/68/
Topics
Give a bunch of arrays and a target value, and in this heap of arrays find three numbers that make their sum equal to the target value.
Online test
http://www.lintcode.com/en/problem/3-sum/
Answer
If the first element in the array of the original problem we use AI to express, the target value we use V to represent.
The method of this problem is very similar to the second solution of 2 sum. First of all, let's put the array in order first, then we still need three pointers i,j,k, we assume i<j<k, because we ordered, then A[i]<a[j]<a[k], actually test instructions can be converted to a[i]+a[j]+a[k]=v. If we enumerate I, then test instructions can be converted to an element greater than a[i] to find a[j]+a[k] = V-a[i], then this problem is 2sum, so we can use 2sum two pointers to one end of the method to solve the problem.
Nine-chapter algorithm surface Test 3 sum