十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
1.Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Given nums = [2, 7, 11, 15], target = 9, Because nums[0] + nums[1] = 2 + 7 = 9, return [0, 1]. UPDATE (2016/2/13): The return format had been changed to zero-based indices. Please read the above updated description carefully. Subscribe to see which companies asked this questio
/** * Note: The returned array must be malloced, assume caller calls free(). */ int* twoSum(int* nums, int numsSize, int target) { int i,j; int *a = (int *)malloc(sizeof(int) * 2); for(i=0;iLeetCode第一题!!!!没想到两层循环就解决了,想想还有点激动。看了网上才知道这样
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:域名与空间、雅安服务器托管、营销软件、网站建设、扶余网站维护、网站推广。
时间复杂度O(N*2)。
好像快点的话还可以hash表?
有机会再说吧[%>_<%]
网站标题:LeetCode001TwoSumC语言
转载来于:http://mswzjz.cn/article/jidihc.html