why error


  • 0
    S

    /**

    • Note: The returned array must be malloced, assume caller calls free().
      /
      int
      twoSum(int* nums, int numsSize, int target) {
      int i,j;
      int a=0;
      for(i=0;i<numsSize;i++)
      for(j=i+1;j<numsSize;j++)
      {
      a=nums[i]+nums[j];
      }
      if(a==target)
      {
      printf("[i,j]\n",i,j);
      }
      else{
      return 0;
      }

    }


  • 0
    L

    What error do you get? Do you realized it is an O(n^2) solution that is not acceptable?


Log in to reply
 

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