{"id":89,"date":"2017-07-25T19:43:40","date_gmt":"2017-07-25T11:43:40","guid":{"rendered":"https:\/\/www.ccagml.com\/?p=89"},"modified":"2018-11-27T16:34:35","modified_gmt":"2018-11-27T08:34:35","slug":"1-two-sum","status":"publish","type":"post","link":"https:\/\/www.ccagml.com\/?p=89","title":{"rendered":"1. Two Sum"},"content":{"rendered":"<p>Given an array of integers, return\u00a0<strong>indices<\/strong>\u00a0of the two numbers such that they add up to a specific target.<\/p>\n<p>You may assume that each input would have\u00a0<strong><em>exactly<\/em><\/strong>\u00a0one solution, and you may not use the\u00a0<em>same<\/em>\u00a0element twice.<\/p>\n<p><strong>Example:<\/strong><\/p>\n<pre>Given nums = [2, 7, 11, 15], target = 9,\r\n\r\nBecause nums[<strong>0<\/strong>] + nums[<strong>1<\/strong>] = 2 + 7 = 9,\r\nreturn [<strong>0<\/strong>, <strong>1<\/strong>].<\/pre>\n<h2>python<\/h2>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> \r\nclass Solution(object):\r\n    def twoSum(self,nums, target):\r\n        for a in range(0, len(nums)):\r\n            for b in range(0, len(nums)):\r\n                if (nums[a] + nums[b] == target and a != b):\r\n                    return [a, b]\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Given an array of integers, return\u00a0indices\u00a0of the two n<a href=\"https:\/\/www.ccagml.com\/?p=89\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">1. Two Sum<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[29,20],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/89"}],"collection":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=89"}],"version-history":[{"count":4,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions"}],"predecessor-version":[{"id":91,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/89\/revisions\/91"}],"wp:attachment":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=89"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=89"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=89"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}