{"id":116,"date":"2017-08-03T20:11:32","date_gmt":"2017-08-03T12:11:32","guid":{"rendered":"https:\/\/www.ccagml.com\/?p=116"},"modified":"2018-11-27T16:15:42","modified_gmt":"2018-11-27T08:15:42","slug":"66-plus-one","status":"publish","type":"post","link":"https:\/\/www.ccagml.com\/?p=116","title":{"rendered":"66. Plus One"},"content":{"rendered":"<p>Given a\u00a0<strong>non-empty<\/strong>\u00a0array of digits\u00a0representing a non-negative integer, plus one to the integer.<\/p>\n<p>The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.<\/p>\n<p>You may assume the integer does not contain any leading zero, except the number 0 itself.<\/p>\n<p><strong>Example 1:<\/strong><\/p>\n<pre><strong>Input:<\/strong> [1,2,3]\r\n<strong>Output:<\/strong> [1,2,4]\r\n<strong>Explanation:<\/strong> The array represents the integer 123.\r\n<\/pre>\n<p><strong>Example 2:<\/strong><\/p>\n<pre><strong>Input:<\/strong> [4,3,2,1]\r\n<strong>Output:<\/strong> [4,3,2,2]\r\n<strong>Explanation:<\/strong> The array represents the integer 4321.<\/pre>\n<p><strong>Python<\/strong><\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\"> \r\nclass Solution(object):\r\n    def plusOne(self, digits):\r\n        &quot;&quot;&quot;\r\n        :type digits: List[int]\r\n        :rtype: List[int]\r\n        [1,2,3]\r\n        &quot;&quot;&quot;\r\n        a= 0\r\n        for i in digits:\r\n            a = a*10 + i\r\n        a += 1\r\n        b = []\r\n        for i in str(a):\r\n            b.append(int(i))\r\n        return b\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Given a\u00a0non-empty\u00a0array of digits\u00a0representing a non-ne<a href=\"https:\/\/www.ccagml.com\/?p=116\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">66. Plus One<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[29,20],"tags":[],"_links":{"self":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/116"}],"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=116"}],"version-history":[{"count":1,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions"}],"predecessor-version":[{"id":117,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=\/wp\/v2\/posts\/116\/revisions\/117"}],"wp:attachment":[{"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=116"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=116"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ccagml.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=116"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}