Leetcode-TwoSum
今天心血來潮了完成人生第一題leetcode /** * Note: The returned array must be malloced, assume caller calls free(). */ int* twoSum(int* nums, int numsSize, int target) { int *a= (int*)malloc(2*sizeof(int)); for(int i=0; i<numsSize; i++){ for(int j=i+1; j<numsSize; j++){ if(nums[i]+nums[j]==target&&i!=j){ a[0]=i; a[1]=j; //return a; } } } return a; } 詳細之後再補