Skip to content

Commit 9cd189b

Browse files
committed
two-sum solution
1 parent eb9f6ce commit 9cd189b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

two-sum/shinheekim.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
public int[] twoSum(int[] nums, int target) {
3+
int[] result = new int[2];
4+
5+
for (int i = 0; i < nums.length; i++){
6+
for (int j = i + 1; j < nums.length; j++){
7+
if (nums[i] + nums[j] == target){
8+
result[0] = i;
9+
result[1] = j;
10+
return result;
11+
}
12+
}
13+
}
14+
return null;
15+
}
16+
}

0 commit comments

Comments
 (0)