Skip to content

Commit 549a265

Browse files
authored
0001_two_sum.java
1 parent ea13071 commit 549a265

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

0001_two_sum.java

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

0 commit comments

Comments
 (0)