{"id":940,"date":"2017-04-28T14:19:57","date_gmt":"2017-04-28T22:19:57","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=940"},"modified":"2017-04-28T14:19:57","modified_gmt":"2017-04-28T22:19:57","slug":"given-array-of-positive-negative-numbers-find-23-of-them-that-sum-to-zero","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=940","title":{"rendered":"Given Array of positive negative numbers find 2,3 of them that sum to zero"},"content":{"rendered":"<p> Given an array of numbers with positive and negative, find pairs that sum to zero \u00a0<br \/>\na) sort the numbers<br \/>\nb) start 2 pointers from from begin and end<br \/>\nc) if sum is > or < = then move appropriate pointer. \n\n Above question, but now finding 3 numbers which sums to zero. \na) for each number in array as target (index:0, 1, 2, etc)\n   start 2 pointers  from i+1 and len-1\n   if sum of target + 2 pointers is > 0 decrement second pointer<br \/>\n   if sum of target + 2 pointers is < 0 increment first pointer\n\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Given an array of numbers with positive and negative, find pairs that sum to zero \u00a0 a) sort the numbers b) start 2 pointers from from begin and end c) if sum is > or < = then move appropriate pointer. Above question, but now finding 3 numbers which sums to zero. a) for each &hellip; <a href=\"http:\/\/www.tech.dimprash.com\/?p=940\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Given Array of positive negative numbers find 2,3 of them that sum to zero<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-940","post","type-post","status-publish","format-standard","hentry","category-algorithms"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/940","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=940"}],"version-history":[{"count":1,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/940\/revisions"}],"predecessor-version":[{"id":941,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/940\/revisions\/941"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=940"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=940"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=940"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}