where is wrong with this code ,i can not find ,it is running in VS2016 and make the result ,who can find the bug


  • 0
    S

    int* twoSum(int* nums, int numsSize, int target) {
    int temp[2] ={0};
    int i =0, j =0;
    for(i = 0;i<numsSize;i++)
    {
    for(j = i+1;j < numsSize;j++)
    {
    if(nums[j] == target - nums[i])
    //if(nums[i] + nums[j] == target)
    break;
    }
    break;
    }
    temp[0] = nums[i];
    temp[1] = nums[j];
    return temp;
    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.