在leetCode看到一题目
Given a Binary Search Tree and a target number, return true if there exist two elements in the BST such that their sum is equal to the given target.
Example 1:
Input:
5
...
var threeSumClosest = function(nums, target) { let ans = nums[0] + nums[1] + nums[2]; const len = nums.length; nums.sort((a, b) => a - b); // 排序 for (let i = 0; i < len ; i++) {...