当前位置 : 主页 > 编程语言 > c++ >

LeetCode_Lrean

来源:互联网 收集:自由互联 发布时间:2021-06-30
Two_sum public int[] solution1(int[] nums,int target){HashMap map = new HashMap (); int[] a = new int[2]; for (int i = 0; i nums.length; i++) { int solution = target - nums[i]; if(map.containsKey(solution) map.get(solution)!=i){ a[0] = i; a
Two_sum
public int[] solution1(int[] nums,int target){
		HashMap
 
   map = new HashMap
  
   (); int[] a = new int[2]; for (int i = 0; i < nums.length; i++) { int solution = target - nums[i]; if(map.containsKey(solution) && map.get(solution)!=i){ a[0] = i; a[1] = map.get(solution); } map.put(nums[i], i); } return a; }
  
 
上一篇:XMLKit.java
下一篇:String 字符串反转
网友评论