Home > Back-end >  The sum of two Numbers (C)
The sum of two Numbers (C)

Time:01-06

Void getsum (int nums [], int n, int target, int * a, int * b) {
Int I=0, j=n - 1;
While (iIf (nums nums [I] + [j] & gt; Target) {
* a=I; * b=j; return ; }
Else if (nums nums [I] + [j] & gt; Target) {
J -;
} else {i++; }
}
}

CodePudding user response:

Entirely correct, no problem, don't know what to achieve function, who also can't help you,

CodePudding user response:

First judgment to the if (nums nums [I] + [j]==target),
Input int nums if [] should be sorted array,
Other if do not have what problem, do you have any question, look at the building Lord,
  • Related