Skip to content

Commit b9b375d

Browse files
committed
added 6kyu problem
1 parent a74e99c commit b9b375d

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎CodeWars/6kyu/TwoSum.java‎

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

0 commit comments

Comments
 (0)