diff options
| author | Steve Lee <me@xiangyangli.com> | 2017-12-02 06:03:52 +0800 |
|---|---|---|
| committer | Steve Lee <me@xiangyangli.com> | 2017-12-02 06:03:52 +0800 |
| commit | c3cf173d30db6cff2561696a46abfcdef538bf71 (patch) | |
| tree | 4fc46c542d759a4ec8da3b57afe00ec6323f3ab1 /leetcode/1_two_sum.c | |
| parent | b46c49228497cb440467167bad3123c327bd620f (diff) | |
| download | 42-c3cf173d30db6cff2561696a46abfcdef538bf71.tar.xz 42-c3cf173d30db6cff2561696a46abfcdef538bf71.zip | |
category
Diffstat (limited to 'leetcode/1_two_sum.c')
| -rw-r--r-- | leetcode/1_two_sum.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/leetcode/1_two_sum.c b/leetcode/1_two_sum.c deleted file mode 100644 index fe29ecc..0000000 --- a/leetcode/1_two_sum.c +++ /dev/null @@ -1,26 +0,0 @@ -#include <stdio.h> - -int result[2]; - -int* two_sum(int* nums, int nums_size, int target) -{ - int i, j; - for(i = 0; i < nums_size; i++) - for(j = 0; j < nums_size; j++) - if(nums[i] + nums[j] == target) { - printf("%d+%d = %d\n", nums[i], nums[j], target); - result[0] = i; - result[1] = j; - return result; - } - -} - -int main() -{ - int nums[4] = {2, 7, 11, 15}; - two_sum(nums, 4, 9); - printf("%d, %d\n",result[0], result[1]); - - return 0; -} |
