两数之和
题目
测试样例
代码
int* twoSum(int* nums, int numsSize, int target, int* returnSize) { *returnSize = 2; int* p = (int*)malloc(8); int i = 0; int j = 0; for ( i = 0 ; i < numsSize - 1 ; i++) { for (j = i + 1 ; j < numsSize ; j++) { if (nums[i] + nums[j] == target) { p[0] = i; p[1] = j; } } } return p; }
标签:numsSize,暴力,nums,int,returnSize,++,LeetCode,两数 From: https://www.cnblogs.com/Code-wangg/p/17093857.html