https://leetcode.com/problems/two-sum/description/?envType=study-plan-v2&envId=top-interview-150
class Solution {
public int[] twoSum(int[] nums, int target) {
int[] answer = new int[2];
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0 ; i < nums.length ; i ++) {
if (map.containsKey(target - nums[i])) {
answer[0] = map.get(target - nums[i]);
answer[1] = i;
break;
}
if (!map.containsKey(nums[i])) {
map.put(nums[i], i);
}
}
return answer;
}
}