public class Solution {
    public int[] twoSum(int[] nums, int target) {
        int[] arr = {0,1}; 
    for(int i = 0;i < nums.length; i++){
        for(int j = 0;j< nums.length;j++){
            if(nums[i]+nums[j]==target){
            arr[0] = i;
            arr[1] = j;
                return arr;
            }
        }
    }
    return arr;
    }

leetcode 1. Two Sum相关推荐

  1. leetcode 304. Range Sum Query 2D - Immutable |304. 二维区域和检索 - 矩阵不可变(二维前缀和问题)

    题目 https://leetcode.com/problems/range-sum-query-2d-immutable/ 题解 本题是 medium 难度,二维前缀和问题.相似题目有: Easy: ...

  2. 【动态规划】LeetCode 377. Combination Sum IV

    LeetCode 377. Combination Sum IV Solution1: 我的未能AC的答案 题目描述的和前几道题差不多,但实际上不能用DFS来做(会超时),要用动态规划,还是记录一下吧 ...

  3. 【DFS】LeetCode 39. Combination Sum

    LeetCode 39. Combination Sum Solution1: DFS,这个套路要熟记啊! class Solution { public:vector<vector<in ...

  4. LeetCode 167.Two Sum II 解题报告

    LeetCode 167.Two Sum II 解题报告 题目描述 Given an array of integers that is already sorted in ascending ord ...

  5. leetcode 1005 Maximize Sum Of Array After K Negations

    leetcode 1005 Maximize Sum Of Array After K Negations 1.题目描述 2.解题思路 3.Python代码 1.题目描述 给定一个整数数组 A,我们只 ...

  6. [勇者闯LeetCode] 1. Two Sum

    [勇者闯LeetCode] 1. Two Sum Description Given an array of integers, return indices of the two numbers s ...

  7. [勇者闯LeetCode] 112. Path Sum

    [勇者闯LeetCode] 112. Path Sum Description Given a binary tree and a sum, determine if the tree has a r ...

  8. 数据结构线段树介绍与笔试算法题-LeetCode 307. Range Sum Query - Mutable--Java解法

    此文首发于我的个人博客:zhang0peter的个人博客 LeetCode题解文章分类:LeetCode题解文章集合 LeetCode 所有题目总结:LeetCode 所有题目总结 线段树(Segme ...

  9. LeetCode 653. Two Sum IV - Input is a BST--Python解法

    题目地址:Two Sum IV - Input is a BST - LeetCode Given a Binary Search Tree and a target number, return t ...

  10. LeetCode 167. Two Sum II - Input array is sorted--Python解法

    题目地址:Two Sum II - Input array is sorted - LeetCode Given an array of integers that is already sorted ...

最新文章

  1. mysql怎么查看是否存在死锁_mysql怎么查看有没有死锁
  2. 从Openvswitch代码看网络包的旅程
  3. mysql忘记密码可以卸载吗_mysql忘记密码,修改密码重新安装的一些问题
  4. 关于Puremvc的理解
  5. 返回一个二维整数数组中最大子数组的和
  6. android view超出屏幕_Android APP界面保持屏幕常亮方法
  7. 把一个英语句子中的单词次序颠倒后输出。例如输入“how are you”,输出“you are how”;...
  8. 一文读懂开源许可证异同
  9. postfix报错postfix: fatal: parameter inet_interfaces: no local interface found for ::1
  10. (翻译).NET应用架构
  11. 交换机putty怎么调试_弱电工程视频监控系统设计、安装、调试、维护全过程讲解...
  12. Q窗口操作函数(窗口最大化,全屏,隐藏最大化最小化按钮)
  13. springboot2源码1-SpringApplication实例化
  14. 我的linux redhat6.0之路-1.2
  15. 怎么配置堡垒机_轻量级堡垒机teleport的使用
  16. HTML5的10大优势
  17. 怎么下载php文件的电影,下电影下下来是.php格式,请问怎么打开?
  18. 雷林鹏分享Node.js Buffer(缓冲区)
  19. 完整的产品管理工作流程
  20. PLC模拟量控制的3个要求

热门文章

  1. 谷歌浏览器添加React Developer Tools和 Redux DevTools
  2. C++11中emplace的使用
  3. vmware配置linux虚拟机与windows共享存储
  4. 爬虫-处理m3u8文件
  5. C++ 10 overloaded operators
  6. vlan接口的作用是什么?什么是静态路由?
  7. vue中展示md文档
  8. Ubuntu18.04下完全卸载nginx服务器
  9. 详细看懂动态代理使用:以胡歌和经纪人的例子
  10. 裁剪圆形图片的自定义控件