当前位置:网站首页>两数之和c语言实现[通俗易懂]
两数之和c语言实现[通俗易懂]
2022-07-01 16:49:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
int *twoSum(int *nums , int numsSize , int target , int *returnSize)
{
int i = 0 , j = 0;
*returnSize = 2;
int *a = (int *)malloc(sizeof(int) * 2);
for(i = 0;i<numsSize;i++)
{
for(j=i+1;j<numsSize;j++)
{
if(nums[i] + nums[j] == 0)
{
a[0] = i;
a[1] = j;
return a;
}
}
}
return a;
}发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/130942.html原文链接:https://javaforall.cn
边栏推荐
- 单例模式的懒汉模式跟恶汉模式的区别
- sql刷题586. 订单最多的客户
- 中国酶制剂市场预测与投资战略研究报告(2022版)
- P2592 [zjoi2008] birthday party (DP)
- 可迭代对象与迭代器、生成器的区别与联系
- How wild are hackers' ways of making money? CTF reverse entry Guide
- 英特尔开源深度学习工具库 OpenVINO,将加大与本土软硬件方合作,持续开放
- Computed property “xxx“ was assigned to but it has no setter.
- 中国氮化硅陶瓷基板行业研究与投资前景报告(2022版)
- 荣威 RX5 的「多一点」产品策略
猜你喜欢
随机推荐
【Try to Hack】vulnhub DC4
The difference between the lazy mode of singleton mode and the evil mode
Babbitt | yuan universe daily must read: Naixue coin, Yuan universe paradise, virtual stock game Do you understand Naixue's tea's marketing campaign of "operation pull full"
SystemVerilog-结构体(二)
存在安全隐患 起亚召回部分K3新能源
在MeterSphere接口测试中如何使用JMeter函数和MockJS函数
SystemVerilog structure (II)
可迭代对象与迭代器、生成器的区别与联系
How to restore the system with one click on Lenovo laptop
Research and investment strategy report of hydroxypropyl beta cyclodextrin industry in China (2022 Edition)
[C language foundation] 12 strings
Report on Market Research and investment prospects of ammonium dihydrogen phosphate industry in China (2022 Edition)
Chinese diosgenin market forecast and investment strategy report (2022 Edition)
Sword finger offer II 015 All modifiers in the string
Introduction to software engineering - Chapter 6 - detailed design
剑指 Offer 20. 表示数值的字符串
SQL question brushing 586 Customers with the most orders
判断二叉树是否为二叉搜索树
Jojogan practice
软件工程导论——第六章——详细设计









![[C language foundation] 12 strings](/img/42/9c024eb08eb935fe66c3aaac7589d8.jpg)