{"id":74,"date":"2008-08-06T16:52:13","date_gmt":"2008-08-06T16:52:13","guid":{"rendered":"http:\/\/positech.co.uk\/cliffsblog\/?p=74"},"modified":"2008-08-06T16:52:49","modified_gmt":"2008-08-06T16:52:49","slug":"algorithmic-dilemma","status":"publish","type":"post","link":"https:\/\/www.positech.co.uk\/cliffsblog\/2008\/08\/06\/algorithmic-dilemma\/","title":{"rendered":"Algorithmic dilemma"},"content":{"rendered":"<p>Here is a puzzle:<\/p>\n<p>I have lists of neutral comments, positive comments, and negative comments. Any of the lists could be empty or of any size.<\/p>\n<p>I wish to select roughly 2 comments in total, sometimes 1, sometimes 3. There is a chance that I will only have a total of 1 comment to choose from anyway (in all 3 lists)<\/p>\n<p>I also have a value that is positive or negative. If it&#8217;s positive I need to ensure not all my comments I select are negative, given that there are some positive ones. If its negative, I need to do the reverse.<\/p>\n<p style=\"text-align: center;\"><strong>How do you do that?<\/strong><\/p>\n<p>If the mere thought of it makes your head explode, you will never be a programmer. If you can see immediately how to do it, in explicit steps, efficiently and accurately. Then you may be a very good programmer one day. Hopefully I&#8217;ll have sussed it before anyone posts a good reply :D<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here is a puzzle: I have lists of neutral comments, positive comments, and negative comments. Any of the lists could be empty or of any size. I wish to select roughly 2 comments in total, sometimes 1, sometimes 3. There is a chance that I will only have a total of 1 comment to choose<\/p>\n<p class=\"text-right\"><span class=\"screen-reader-text\">Continue Reading&#8230; Algorithmic dilemma<\/span><a class=\"btn btn-secondary continue-reading\" href=\"https:\/\/www.positech.co.uk\/cliffsblog\/2008\/08\/06\/algorithmic-dilemma\/\">Continue Reading&#8230;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-74","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/74","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/comments?post=74"}],"version-history":[{"count":0,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/posts\/74\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/media?parent=74"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/categories?post=74"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.positech.co.uk\/cliffsblog\/wp-json\/wp\/v2\/tags?post=74"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}