Two/Three Sum Workout
Two/Three Sum Workout https://leetcode.com/problems/two-sum/ 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer, Integer> valueIndex = new HashMap<>(); for (int i = 0; i < nums.length; i++) { Integer find = valueIndex.get(target - nums[i]); if (find != null) { return new int[] {find, i}; } valueIndex.put(nums[i], i); } return new int[] {-1, -1}; } } https://leetcode....