Skip to content

Commit f6fafb7

Browse files
committed
Done java 01
1 parent 8e41e0d commit f6fafb7

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
1.5 KB
Binary file not shown.

solution/0000-0099/0001.Two Sum/Solution.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
import java.util.Arrays;
2+
import java.util.HashMap;
3+
import java.util.Map;
4+
5+
16
class Solution {
27
public int[] twoSum(int[] nums, int target) {
38
Map<Integer, Integer> d = new HashMap<>();
@@ -10,4 +15,13 @@ public int[] twoSum(int[] nums, int target) {
1015
d.put(x, i);
1116
}
1217
}
18+
19+
public static void main(String[] args){
20+
Solution s = new Solution();
21+
int[] nums = {2, 7, 11, 15};
22+
int target = 9;
23+
int[] result = s.twoSum(nums, target);
24+
System.out.println("Result: "+ Arrays.toString(result));
25+
}
26+
1327
}

0 commit comments

Comments
 (0)