Array Four

(1)Two Sum 解题思路: 使用hashmap,将(目标和-当前元素值,当前元素位置)存入,当遇到(目标和-当前元素值)的值时,取出i即可。 1 public class Solution { 2 public int[] twoSum(int[] nums, int target) { 3 HashMap<Integer,Integer> map = new
相关文章
相关标签/搜索