{"action":"created","issue":{"url":"https://api.github.com/repos/zhuangjinxin/leetcode/issues/1","repository_url":"https://api.github.com/repos/zhuangjinxin/leetcode","labels_url":"https://api.github.com/repos/zhuangjinxin/leetcode/issues/1/labels{/name}","comments_url":"https://api.github.com/repos/zhuangjinxin/leetcode/issues/1/comments","events_url":"https://api.github.com/repos/zhuangjinxin/leetcode/issues/1/events","html_url":"https://github.com/zhuangjinxin/leetcode/issues/1","id":310204546,"number":1,"title":"Two Sum","user":{"login":"zhuangjinxin","id":7218836,"avatar_url":"https://avatars2.githubusercontent.com/u/7218836?v=4","gravatar_id":"","url":"https://api.github.com/users/zhuangjinxin","html_url":"https://github.com/zhuangjinxin","followers_url":"https://api.github.com/users/zhuangjinxin/followers","following_url":"https://api.github.com/users/zhuangjinxin/following{/other_user}","gists_url":"https://api.github.com/users/zhuangjinxin/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuangjinxin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuangjinxin/subscriptions","organizations_url":"https://api.github.com/users/zhuangjinxin/orgs","repos_url":"https://api.github.com/users/zhuangjinxin/repos","events_url":"https://api.github.com/users/zhuangjinxin/events{/privacy}","received_events_url":"https://api.github.com/users/zhuangjinxin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-31T02:13:56Z","updated_at":"2018-03-31T02:25:13Z","closed_at":null,"author_association":"OWNER","body":"Given an array of integers, return **indices** of the two numbers such that they add up to a specific target.\r\n\r\nYou may assume that each input would have **exactly** one solution, and you may not use the same element twice.\r\n\r\nExample:\r\n```\r\nGiven nums = [2, 7, 11, 15], target = 9,\r\n\r\nBecause nums[0] + nums[1] = 2 + 7 = 9,\r\nreturn [0, 1].\r\n```"},"comment":{"url":"https://api.github.com/repos/zhuangjinxin/leetcode/issues/comments/377659334","html_url":"https://github.com/zhuangjinxin/leetcode/issues/1#issuecomment-377659334","issue_url":"https://api.github.com/repos/zhuangjinxin/leetcode/issues/1","id":377659334,"user":{"login":"zhuangjinxin","id":7218836,"avatar_url":"https://avatars2.githubusercontent.com/u/7218836?v=4","gravatar_id":"","url":"https://api.github.com/users/zhuangjinxin","html_url":"https://github.com/zhuangjinxin","followers_url":"https://api.github.com/users/zhuangjinxin/followers","following_url":"https://api.github.com/users/zhuangjinxin/following{/other_user}","gists_url":"https://api.github.com/users/zhuangjinxin/gists{/gist_id}","starred_url":"https://api.github.com/users/zhuangjinxin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zhuangjinxin/subscriptions","organizations_url":"https://api.github.com/users/zhuangjinxin/orgs","repos_url":"https://api.github.com/users/zhuangjinxin/repos","events_url":"https://api.github.com/users/zhuangjinxin/events{/privacy}","received_events_url":"https://api.github.com/users/zhuangjinxin/received_events","type":"User","site_admin":false},"created_at":"2018-03-31T02:25:13Z","updated_at":"2018-03-31T02:25:13Z","author_association":"OWNER","body":"```\r\npublic int[] twoSum(int[] nums, int target) {\r\n    Map<Integer, Integer> map = new HashMap<>();\r\n    for (int i = 0; i < nums.length; i++) {\r\n        int complement = target - nums[i];\r\n        if (map.containsKey(complement)) {\r\n            return new int[] { map.get(complement), i };\r\n        }\r\n        map.put(nums[i], i);\r\n    }\r\n    throw new IllegalArgumentException(\"No two sum solution\");\r\n}\r\n```\r\n时间复杂度：O(n)\r\n空间复杂度：O(n)"}}
{"actor":{"display_login":"zhuangjinxin"}}