int *twoSum(int *nums, int numsSize, int target, int *returnSize)
{
int *result = (int *)malloc(sizeof(int) * 2);
for (int i = 0; i < numsSize - 1; i++)
{
for (int j = i + 1; j < numsSize; j++)
{
if (nums[i] + nums[j] == target)
{
result[0] = i;
result[1] = j;
*returnSize = 2;
return result;
}
}
}
return result;
}
leetcode暴力法第一题两数之和
最新推荐文章于 2022-07-29 21:14:42 发布