Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1]
思路:使用HashMap存储index,达到logn的时间复杂度。
Input: nums = [2,7,11,15], target = 9
Output: [0,1]
Output: Because nums[0] + nums[1] == 9, we return [0, 1]
思路:使用HashMap存储index,达到logn的时间复杂度。