欢迎光临散文网 会员登陆 & 注册

马哥高端Go语言百万并发高xin班微服务分布式高可用 Go高并发2022

2022-10-25 00:12 作者:al_sa  | 我要投稿

public static int[] twoSum2(int[] nums, int target) {        Map<Integer, Integer> map = new HashMap<>();        for(int i = 0; i<nums.length;i++) {            map.put(nums[i], i);        }                for(int i = 0;i<nums.length;i++) {            int c = target - nums[i];            if(map.containsKey(c) && map.get(c) != i) {                return new int[] {i,map.get(c)};            }        }              throw new IllegalArgumentException("没找到");      }

马哥高端Go语言百万并发高xin班微服务分布式高可用 Go高并发2022的评论 (共 条)

分享到微博请遵守国家法律