[LintCode solution to a problem | 3] and the number of

[Title Description
given array and a certain integer target of the n integer, to find the subscripts i, j, the array element k is 0 <= i <j <k <n, satisfy the condition nums [i] + nums [ j] + nums [k] < target.

[Title] Sample

Sample 1:
Input: nums = [-2,0,1,3], target = 2
Output: 2
Explanation:
because there are two of the three elements and their sum is less than 2:
[-2, 0, 1 ]
[-2, 0, 3]

Sample 2:
Input: nums = [-2,0, -1,3] , target = 2
Output: 3
Explanation:
Because there are three of the three elements and their sum is less than 2:
[-2, 0, 1 ]
[-2, 0, 3],
[-2, -1, 3]

[Title parsing (Java)]
Enumeration one of the numbers, so that the two do double the number of remaining pointer arithmetic can be. Specific analysis to see pictures oh ~

Click Lintcode online evaluation

Published 438 original articles · won praise 64 · views 110 000 +

Guess you like

Origin blog.csdn.net/JiuZhang_ninechapter/article/details/103729868