class Solution {
public int[] twoSum(int[] nums, int target) {
int[] a = new int[2];
for(int i = 0;i < nums.length ; i++){
for(int j = 0;j < nums.length ; j++){
if(nums[i] + nums[j] == target){
a[0] = j;
a[1] = i;
break;
}
}
}
return a;
}
}
LeetCode刷题笔记-两数之和
最新推荐文章于 2024-09-04 21:39:45 发布