当前位置:网站首页>两数之和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
边栏推荐
- ShenYu 网关开发:在本地启用运行
- Detailed explanation of activity life cycle and startup mode
- 【C語言補充】判斷明天是哪一天(明天的日期)
- 换掉UUID,NanoID更快更安全!
- 存在安全隐患 起亚召回部分K3新能源
- 荣威 RX5 的「多一点」产品策略
- Redis Distributed Lock
- C語言輸入/輸出流和文件操作
- Report on Market Research and investment prospects of ammonium dihydrogen phosphate industry in China (2022 Edition)
- Soft test software designer full truth simulation question (including answer analysis)
猜你喜欢

Girls who want to do software testing look here

Cookies and session keeping technology

Alibaba cloud, Zhuoyi technology beach grabbing dialogue AI

SQL question brushing 586 Customers with the most orders

【flask入门系列】Cookie与Session

Iommu/smmuv3 code analysis (10) page table operation

巴比特 | 元宇宙每日必读:奈雪币、元宇宙乐园、虚拟股票游戏...奈雪的茶这波“操作拉满”的营销活动你看懂了吗?...

阿里云、追一科技抢滩对话式AI

Redis distributed lock

Vulnhub range hacksudo Thor
随机推荐
vulnhub靶场-Hacker_Kid-v1.0.1
求求你们,别再刷 Star 了!这跟“爱国”没关系!
【C语言补充】判断明天是哪一天(明天的日期)
整形数组合并【JS】
(12) About time-consuming printing
阿里云、追一科技抢滩对话式AI
In aks, use secret in CSI driver mount key vault
SQL question brushing 627 Change gender
AI高考志愿填报:大厂神仙打架,考生付费围观
Dataframe gets the number of words in the string
Hidden Markov model (HMM): model parameter estimation
换掉UUID,NanoID更快更安全!
中国乙腈市场预测与战略咨询研究报告(2022版)
官宣!香港科技大学(广州)获批!
There is a new breakthrough in quantum field: the duration of quantum state can exceed 5 seconds
C語言輸入/輸出流和文件操作
How to cancel automatic search and install device drivers for laptops
拼接字符串,得到字典序最小的结果
How wild are hackers' ways of making money? CTF reverse entry Guide
剑指 Offer 20. 表示数值的字符串