LeetCode-1-Two Sum(C语言实现)
来源:互联网 发布:mac电脑磁盘在哪里 编辑:程序博客网 时间:2024/06/06 13:21
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
int i, j;
int *get;
get = (int*)malloc(2 * sizeof(int));
for (i = 0; i < numsSize - 1; ++i)
for(j = i + 1; j < numsSize; ++j)
if(nums[i] + nums[j] == target)
{
get[0] = i;
get[1] = j;
break;
break;
}
return get;
}
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target) {
int i, j;
int *get;
get = (int*)malloc(2 * sizeof(int));
for (i = 0; i < numsSize - 1; ++i)
for(j = i + 1; j < numsSize; ++j)
if(nums[i] + nums[j] == target)
{
get[0] = i;
get[1] = j;
break;
break;
}
return get;
}
阅读全文
0 0
- LeetCode-1-Two Sum(C语言实现)
- LeetCode 1. Two Sum(c语言实现)
- leetcode 1:two sum(C语言)
- [C语言][LeetCode][1]Two Sum
- 1---LeetCode【Two Sum】|C语言|总结
- LeetCode::Two Sum C语言
- LeetCode::Two Sum C语言
- Leetcode c语言-Two Sum
- [LeetCode]1 Two Sum(C++,Python实现)
- Leetcode[1] Two Sum (c++)
- [LeetCode#1][C]Two Sum
- 【LeetCode-1】 Two Sum(C++)
- LeetCode(1) Two Sum实现
- 【Leetcode】【Python】【C++】1. Two Sum实现
- 【LeetCode编程学习(C语言)】1.Two Sum
- 【LeetCode算法练习(C语言)】Two Sum
- leetcode 1. Two Sum (C语言)12
- leetcode (1) Two Sum js代码实现
- 字符串比较大小 并且去重
- jackson json @JsonIgnore
- 【动态规划】之最长公共子序列长度(难度:1星)
- 最美英文情诗
- Nginx优化及部署LNMP
- LeetCode-1-Two Sum(C语言实现)
- Java Date和MySQL datetime数据类型转换
- MySQL TEXT数据类型的最大长度
- Servlet文件下载例子详解及response的contentType类型大全
- VMware安装KaliLinux2.0
- 蓝桥杯 基础练习 数的读法 【模拟】
- MAVEN SSH的框架整合
- HooK原理简析
- 计算机视觉研究群体及专家主页汇总