Sum of Two Numbers Less Than Target
Given a list of integers nums and an integer target, return the sum of the largest pair of numbers in nums whose sum is less than target. You can assume that there is a solution.
Constraints
2 ≤ n ≤ 100,000wherenis the length ofnums
https://binarysearch.com/problems/Sum-of-Two-Numbers-Less-Than-Target
Examples
Example 1
Input
- nums =
[5, 1, 2, 3] - target =
4
Output
- answer =
3
Explanation
Sum of the largest pair of numbers less than 4 is 1 + 2 = 3.
Leave a comment