This is the first time I try Leetcode. Here is the Java solution to my first Leetcode problem.

We have to find two different indexes, in any order, of two integers which add up to target.

class Solution {
public int[] twoSum(int[] nums, int target) {
for (int i = 0; i < nums.length - 1; i ++) {
for (int ii = i + 1; ii < nums.length; ii ++) {
if (i != ii && nums[i] + nums[ii] == target) {
int result[] = {i, ii};
return result;
}
}
}
return null;
}
}

*Related*