当前位置:网站首页>两数之和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
边栏推荐
- Are you still using charged document management tools? I have a better choice! Completely free
- [C language foundation] 12 strings
- China carbon disulfide industry research and investment strategy report (2022 Edition)
- 存在安全隐患 起亚召回部分K3新能源
- Gold, silver and four want to change jobs, so we should seize the time to make up
- PR basic clip operation / video export operation
- [pyg] document summary and project experience (continuously updated
- 美国国家安全局(NSA)“酸狐狸”漏洞攻击武器平台技术分析报告
- SQL question brushing 627 Change gender
- String类
猜你喜欢
C語言輸入/輸出流和文件操作
Introduction to software engineering - Chapter 6 - detailed design
String的trim()和substring()详解
Gold, silver and four want to change jobs, so we should seize the time to make up
Redis Distributed Lock
(27) Open operation, close operation, morphological gradient, top hat, black hat
How wild are hackers' ways of making money? CTF reverse entry Guide
[pyg] document summary and project experience (continuously updated
Template Engine Velocity Foundation
C语言输入/输出流和文件操作
随机推荐
How to cancel automatic search and install device drivers for laptops
Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
String类
LeetCode中等题之TinyURL 的加密与解密
The difference between the lazy mode of singleton mode and the evil mode
Template engine velocity Foundation
(1) CNN network structure
判断二叉树是否为二叉搜索树
Vulnhub range hacksudo Thor
What is the effect of choosing game shield safely in the game industry?
英特尔开源深度学习工具库 OpenVINO,将加大与本土软硬件方合作,持续开放
Judge whether a binary tree is a balanced binary tree
Hi Fun Summer, play SQL planner with starrocks!
荣威 RX5 的「多一点」产品策略
Gold, silver and four want to change jobs, so we should seize the time to make up
What are the differences between PHP and DW
Detailed explanation of activity life cycle and startup mode
Object. fromEntries()
阿里云李飞飞:中国云数据库在很多主流技术创新上已经领先国外
sql刷题627. 变更性别