LeetCode刷题之旅(1)
来源:互联网 发布:乔杉咖啡厅网络剧 编辑:程序博客网 时间:2024/05/18 13:47
解决代码:
public class Solution { public int[] twoSum(int[] nums, int target) { int[] result = new int[2]; for (int i = 0; i < nums.length; i++) { for (int j = i+1; j < nums.length; j++) { if (nums[i] + nums[j] == target) { result[0] = i; result[1] = j; } } } return result; }}
使用了最傻的方法,也就是所谓的暴力破解法,有机会去研究一下别人的做法,当然时间方面肯定会比较耗时。。。。。
0 0
- LeetCode刷题之旅(1)
- LeetCode刷题之旅(2)
- LeetCode刷题之旅(3)
- LeetCode刷题之旅(4)
- LeetCode刷题之旅(5)
- LeetCode刷题之旅(6)
- LeetCode刷题之旅(7)
- LeetCode刷题之旅(5)
- LeetCode刷题之旅(6)
- LeetCode刷题之旅(7)
- LeetCode刷题之旅(8)
- LeetCode刷题之旅(9)
- LeetCode 刷题之旅
- LeetCode之旅(1)
- LeetCode之旅-1
- Leetcode 刷题之哈希表
- LeetCode之旅(2)
- LeetCode之旅(3)
- eclipse安装red5插件
- Java中HashSet详解
- Jquery的treeview插件实现树形结构
- ios 数值计算遇到nan错误处理
- 腾讯测试实习生面试心得
- LeetCode刷题之旅(1)
- 如何判断是否开启超线程
- excel制作甘特图模板
- 微软面试100题-57 (用俩个栈实现队列)
- 博客搬家了
- yii2 GridView常见操作
- 2006年浙江大学计算机及软件工程研究生机试真题-简单计算器
- Ubuntu12.04 安装adb
- Spring 7大功能模块的作用