#1 LeetCode——Two Sum
来源:互联网 发布:淘宝信誉分怎么看 编辑:程序博客网 时间:2024/05/15 08:24
java代码如下
public class Solution { public int[] twoSum(int[] nums, int target) { int len = nums.length; int index1 = 0, index2 = 0; int reduction; for (int i = 0; i < len; i++) { reduction = target - nums[i]; for (int j = i + 1; j < len; j++) { if(reduction == nums[j]) { index1 = i + 1; index2 = j + 1; break; } } } int[] result = {index1, index2}; return result; }}
0 0
- Sum—LeetCode-1 Two Sum
- LeetCode — Two Sum
- LeetCode—Two Sum
- LeetCode—Two Sum
- leetcode—Two Sum
- LeetCode —-Two Sum
- #1 LeetCode——Two Sum
- Leetcode 1——Two Sum
- LeetCode之1—-Two Sum
- LeetCode——Two Sum
- LeetCode——Two Sum
- Leetcode —— Two Sum
- LeetCode——Two Sum
- Two Sum —— Leetcode
- LeetCode——Two Sum
- Two Sum —— leetcode
- LeetCode——Two Sum
- LeetCode:Algorith1 —Two Sum
- 读《 江西59岁老人用鼠药结束了妻子性命》有感
- 【转载,万人坑】const char*, char const*, char*const的区别
- UVALive 5984 Save the Students!(几何)
- 将循环链表插在单链表头部
- Service的理解和用法
- #1 LeetCode——Two Sum
- spring 事务笔记
- swift中出现Optional("xxx")
- Java多线程基础知识(六)
- JDK环境的搭建
- Hbase与BDBMS对比的主要缺点
- JAVA NIO的笔记
- Linux压缩解压命令
- AVRWARE++开发笔记2:开发环境的建立