{"action":"closed","number":1,"pull_request":{"url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/1","id":54204332,"html_url":"https://github.com/abozhilov/Dynamic-Programming/pull/1","diff_url":"https://github.com/abozhilov/Dynamic-Programming/pull/1.diff","patch_url":"https://github.com/abozhilov/Dynamic-Programming/pull/1.patch","issue_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues/1","number":1,"state":"closed","locked":false,"title":"Create puzzle.js","user":{"login":"joenewstrom","id":6558557,"avatar_url":"https://avatars.githubusercontent.com/u/6558557?v=3","gravatar_id":"","url":"https://api.github.com/users/joenewstrom","html_url":"https://github.com/joenewstrom","followers_url":"https://api.github.com/users/joenewstrom/followers","following_url":"https://api.github.com/users/joenewstrom/following{/other_user}","gists_url":"https://api.github.com/users/joenewstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/joenewstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joenewstrom/subscriptions","organizations_url":"https://api.github.com/users/joenewstrom/orgs","repos_url":"https://api.github.com/users/joenewstrom/repos","events_url":"https://api.github.com/users/joenewstrom/events{/privacy}","received_events_url":"https://api.github.com/users/joenewstrom/received_events","type":"User","site_admin":false},"body":"Basic javascript solution to the optimization problem presented. Solution iterates through the pairs of neighbors and compares the improvement in time vs. baseline time of everyone buying individually. If the improvement is greater than the previous best it is stored in the delta variable and the index is stored in the pair variable. Finally, the total time including the neighbors located at the pair index is rolled up and returned by the function.\r\n\r\nEx.\r\n\r\nvar T = [5, 2, 7, 8, 3, 9, 4, 2],\r\nS = [6, 3, 10, 12, 8, 8, 6];\r\nconsole.log(optimize(T,S));","created_at":"2015-12-20T17:59:08Z","updated_at":"2015-12-21T11:39:19Z","closed_at":"2015-12-21T11:39:19Z","merged_at":null,"merge_commit_sha":"5088b21d55893143ee962d73b8fc39de016238ab","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/1/commits","review_comments_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/1/comments","review_comment_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/comments{/number}","comments_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues/1/comments","statuses_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/statuses/a7b8efbd82136d5f9dd5c315fbf71dcb56a41f54","head":{"label":"joenewstrom:master","ref":"master","sha":"a7b8efbd82136d5f9dd5c315fbf71dcb56a41f54","user":{"login":"joenewstrom","id":6558557,"avatar_url":"https://avatars.githubusercontent.com/u/6558557?v=3","gravatar_id":"","url":"https://api.github.com/users/joenewstrom","html_url":"https://github.com/joenewstrom","followers_url":"https://api.github.com/users/joenewstrom/followers","following_url":"https://api.github.com/users/joenewstrom/following{/other_user}","gists_url":"https://api.github.com/users/joenewstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/joenewstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joenewstrom/subscriptions","organizations_url":"https://api.github.com/users/joenewstrom/orgs","repos_url":"https://api.github.com/users/joenewstrom/repos","events_url":"https://api.github.com/users/joenewstrom/events{/privacy}","received_events_url":"https://api.github.com/users/joenewstrom/received_events","type":"User","site_admin":false},"repo":{"id":48331152,"name":"Dynamic-Programming","full_name":"joenewstrom/Dynamic-Programming","owner":{"login":"joenewstrom","id":6558557,"avatar_url":"https://avatars.githubusercontent.com/u/6558557?v=3","gravatar_id":"","url":"https://api.github.com/users/joenewstrom","html_url":"https://github.com/joenewstrom","followers_url":"https://api.github.com/users/joenewstrom/followers","following_url":"https://api.github.com/users/joenewstrom/following{/other_user}","gists_url":"https://api.github.com/users/joenewstrom/gists{/gist_id}","starred_url":"https://api.github.com/users/joenewstrom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joenewstrom/subscriptions","organizations_url":"https://api.github.com/users/joenewstrom/orgs","repos_url":"https://api.github.com/users/joenewstrom/repos","events_url":"https://api.github.com/users/joenewstrom/events{/privacy}","received_events_url":"https://api.github.com/users/joenewstrom/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joenewstrom/Dynamic-Programming","description":"","fork":true,"url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming","forks_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/forks","keys_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/teams","hooks_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/hooks","issue_events_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/issues/events{/number}","events_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/events","assignees_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/assignees{/user}","branches_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/branches{/branch}","tags_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/tags","blobs_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/git/refs{/sha}","trees_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/statuses/{sha}","languages_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/languages","stargazers_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/stargazers","contributors_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/contributors","subscribers_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/subscribers","subscription_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/subscription","commits_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/commits{/sha}","git_commits_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/git/commits{/sha}","comments_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/comments{/number}","issue_comment_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/issues/comments{/number}","contents_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/contents/{+path}","compare_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/merges","archive_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/downloads","issues_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/issues{/number}","pulls_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/pulls{/number}","milestones_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/milestones{/number}","notifications_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/labels{/name}","releases_url":"https://api.github.com/repos/joenewstrom/Dynamic-Programming/releases{/id}","created_at":"2015-12-20T17:47:12Z","updated_at":"2015-12-20T17:47:46Z","pushed_at":"2015-12-20T17:47:45Z","git_url":"git://github.com/joenewstrom/Dynamic-Programming.git","ssh_url":"git@github.com:joenewstrom/Dynamic-Programming.git","clone_url":"https://github.com/joenewstrom/Dynamic-Programming.git","svn_url":"https://github.com/joenewstrom/Dynamic-Programming","homepage":null,"size":1,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"abozhilov:master","ref":"master","sha":"a602880c172d6551d111198ebd3002c9a8eb4e22","user":{"login":"abozhilov","id":191849,"avatar_url":"https://avatars.githubusercontent.com/u/191849?v=3","gravatar_id":"","url":"https://api.github.com/users/abozhilov","html_url":"https://github.com/abozhilov","followers_url":"https://api.github.com/users/abozhilov/followers","following_url":"https://api.github.com/users/abozhilov/following{/other_user}","gists_url":"https://api.github.com/users/abozhilov/gists{/gist_id}","starred_url":"https://api.github.com/users/abozhilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abozhilov/subscriptions","organizations_url":"https://api.github.com/users/abozhilov/orgs","repos_url":"https://api.github.com/users/abozhilov/repos","events_url":"https://api.github.com/users/abozhilov/events{/privacy}","received_events_url":"https://api.github.com/users/abozhilov/received_events","type":"User","site_admin":false},"repo":{"id":48329052,"name":"Dynamic-Programming","full_name":"abozhilov/Dynamic-Programming","owner":{"login":"abozhilov","id":191849,"avatar_url":"https://avatars.githubusercontent.com/u/191849?v=3","gravatar_id":"","url":"https://api.github.com/users/abozhilov","html_url":"https://github.com/abozhilov","followers_url":"https://api.github.com/users/abozhilov/followers","following_url":"https://api.github.com/users/abozhilov/following{/other_user}","gists_url":"https://api.github.com/users/abozhilov/gists{/gist_id}","starred_url":"https://api.github.com/users/abozhilov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abozhilov/subscriptions","organizations_url":"https://api.github.com/users/abozhilov/orgs","repos_url":"https://api.github.com/users/abozhilov/repos","events_url":"https://api.github.com/users/abozhilov/events{/privacy}","received_events_url":"https://api.github.com/users/abozhilov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/abozhilov/Dynamic-Programming","description":"","fork":false,"url":"https://api.github.com/repos/abozhilov/Dynamic-Programming","forks_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/forks","keys_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/keys{/key_id}","collaborators_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/teams","hooks_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/hooks","issue_events_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues/events{/number}","events_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/events","assignees_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/assignees{/user}","branches_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/branches{/branch}","tags_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/tags","blobs_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/git/refs{/sha}","trees_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/git/trees{/sha}","statuses_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/statuses/{sha}","languages_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/languages","stargazers_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/stargazers","contributors_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/contributors","subscribers_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/subscribers","subscription_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/subscription","commits_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/commits{/sha}","git_commits_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/git/commits{/sha}","comments_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/comments{/number}","issue_comment_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues/comments{/number}","contents_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/contents/{+path}","compare_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/compare/{base}...{head}","merges_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/merges","archive_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/downloads","issues_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues{/number}","pulls_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls{/number}","milestones_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/milestones{/number}","notifications_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/labels{/name}","releases_url":"https://api.github.com/repos/abozhilov/Dynamic-Programming/releases{/id}","created_at":"2015-12-20T16:41:06Z","updated_at":"2015-12-20T16:48:42Z","pushed_at":"2015-12-20T18:36:25Z","git_url":"git://github.com/abozhilov/Dynamic-Programming.git","ssh_url":"git@github.com:abozhilov/Dynamic-Programming.git","clone_url":"https://github.com/abozhilov/Dynamic-Programming.git","svn_url":"https://github.com/abozhilov/Dynamic-Programming","homepage":null,"size":3,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/1"},"html":{"href":"https://github.com/abozhilov/Dynamic-Programming/pull/1"},"issue":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues/1"},"comments":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/abozhilov/Dynamic-Programming/statuses/a7b8efbd82136d5f9dd5c315fbf71dcb56a41f54"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":25,"deletions":0,"changed_files":1}}