各位大佬这是leetcode第一题求两数之和,为什么我的代码总是过不了,运行结果总是【0,0】
熊猫果茶 2018-05-26 04:16:26 /**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
int i,j;
int c[2];
int*fp=NULL;
for(j=0;j<=numsSize-1;j++)
for(i=j+1;i<=numsSize;i++)
{
if(nums[j]+nums[i]==target)
{
c[0]=j;
c[1]=i;
}
}
fp=c;
return fp;
}
这是我的代码,希望各位大佬能帮忙看看(c语言)