From f27e4c10723ccbef568bb86b81f22fea4231c5c6 Mon Sep 17 00:00:00 2001 From: yubin <59639035+gogumaC@users.noreply.github.com> Date: Sun, 22 Dec 2024 18:24:50 +0900 Subject: [PATCH] Time: 101 ms (72.32%), Space: 8.7 MB (28.9%) - LeetHub --- 0001-two-sum/0001-two-sum.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 0001-two-sum/0001-two-sum.c diff --git a/0001-two-sum/0001-two-sum.c b/0001-two-sum/0001-two-sum.c new file mode 100644 index 0000000..f475f8b --- /dev/null +++ b/0001-two-sum/0001-two-sum.c @@ -0,0 +1,24 @@ +/** + * Note: The returned array must be malloced, assume caller calls free(). + */ +int* twoSum(int* nums, int numsSize, int target, int* returnSize) { + + int* res = (int *)malloc(sizeof(int)*2); + *returnSize = 2; + + for(int i=0; i