{"action":"created","comment":{"url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/comments/90474215","pull_request_review_id":10990552,"id":90474215,"diff_hunk":"@@ -0,0 +1,97 @@\n+# Bonetrousle\n+[https://www.hackerrank.com/challenges/bonetrousle](https://www.hackerrank.com/challenges/bonetrousle)\n+\n+Difficulty: Medium\n+\n+\n+## Problem\n+### Statement\n+Once upon a time, Papyrus the skeleton went to buy some pasta from the store. The store's inventory is bare-bones and they only sell one thing — boxes of uncooked spaghetti! The store always stocks exactly k boxes of pasta, and each box is numbered sequentially from 1 to k. This box number also corresponds to the number of sticks of spaghetti in the box, meaning the first box contains 1 stick, the second box contains 2 sticks, the third box contains 3 sticks, …, and the k<sup>th</sup> box contains k sticks. Because they only stock one box of each kind, the store has a tendon-cy to sell out of spaghetti.\n+\n+During each trip to the store, Papyrus likes to buy exactly n sticks of spaghetti by purchasing exactly b boxes (no more, no less). Not sure which boxes to purchase, Papyrus calls Sherlock Bones for help but he's also stumped! Do you have the guts to solve this puzzle?\n+\n+Given the values of n, k, and b for t trips to the store, determine which boxes Papyrus must purchase during each trip. For each trip, print a single line of b distinct space-separated integers denoting the box number for each box of spaghetti Papyrus purchases (recall that the store only has one box of each kind). If it's not possible to buy n sticks of spaghetti by purchasing  boxes, print -1 instead.\n+\n+###Input Format\n+\n+The first line contains a single integer, t, denoting the number of trips to the store.\n+Each of the t subsequent lines describes a trip to the store in the form of three space-separated integers describing the respective values of n (the number of sticks to buy), k (the number of boxes the store has for sale), and b (the number of boxes to buy) for that trip to the store.\n+\n+###Constraints\n+\n+* 1 <= t <= 20\n+\n+* 1 <= b <= 10<sup>5</sup>\n+\n+* 1 <= n <= 10<sup>18</sup>\n+\n+* 1 <= k <= 10<sup>18</sup>\n+\n+* b <= k\n+\n+###Output Format\n+\n+For each trip to the store:\n+\n+* If there is no solution, print -1 on a new line.\n+\n+* Otherwise, print a single line of  distinct space-separated integers where each integer denotes the box number (i.e., the number of spaghetti sticks in the box) that Papyrus must purchase.\n+\n+If there are multiple possible solutions, you can print any one of them. Do not print any leading or trailing spaces.\n+\n+### Overview\n+####Given:\n+* The number of boxes to buy, b.\n+* The number of noodles to buy, n.\n+* The set of boxes available to buy {1, 2, ..., k}\n+\n+####Goal:\n+* Pick a subset, S, of the boxes available to buy which:\n+    * has a size equal to b.\n+    * the values of the boxes in S equals n.\n+\n+## Algorithm\n+\n+### Overview\n+<p>\n+For this problem you may have come up with a formula similar to e + (e + 1) + ... + (e + t - 1) = n.\n+Where e is the number of noodles in the first box picked. However this equation by itself will not work.\n+For example if you had the boxes 1, 2, 3, and 4 and you needed 6 noodles, no two consecutive boxes\n+will give you six, but if you pick boxes 2 and 4 you will get 6 noodles. This algorithm modifies the\n+formula above so that it does work. Note that the problem says that any combination of boxes that produces\n+the needed number of noodles is a valid solution.\n+</p>\n+\n+### Pseudo Code\n+1. Read in n, k, and b.\n+2. Make a variable called numConstants, a variable called amountShort, and a variable called e.\n+3. numConstants = (b/2) * (b-1)\n+4. amountShort = (n - numConstants) % b\n+5. e = (n - numConstants) / b\n+6. if e < 1 or (amountShort == 0 and e+b-1 > k) or (amountShort != 0 and e+b > k):\n+    1. print(\"-1\")\n+7. else:\n+    1. Make a variable called boxToSkip and a variable called lastNumPrinted.\n+    2. boxToSkip = b - amountShort\n+    3. lastNumPrinted = e\n+    4. for i = 1 to b:\n+        1. if i == boxToSkip:\n+            1. lastNumPrinted = lastNumPrinted + 2\n+        2. else:\n+            1. lastNumPrinted = lastNumPrinted + 1\n+        3. print(\" \" + lastNumPrinted)\n+\n+Note that the actual problem asks you to do this algorithm for t test cases.\n+\n+### Analysis\n+<p>\n+Since this algorithm uses mainly math, the largest part of the code is the loop that prints\n+the list of boxes out. This loop goes b times and thusly the algorithm's time complexity is O(b).\n+</p>\n+\n+## Conclusion\n+<p>\n+It is important to keep in mind that for this problem some variable values could exceed","path":"Guide/Constructive/Bonetrousle/README.md","position":94,"original_position":94,"commit_id":"ba503447f79299ffc270e6b79f04816162758d35","original_commit_id":"ba503447f79299ffc270e6b79f04816162758d35","user":{"login":"ASAAR","id":1311843,"avatar_url":"https://avatars.githubusercontent.com/u/1311843?v=3","gravatar_id":"","url":"https://api.github.com/users/ASAAR","html_url":"https://github.com/ASAAR","followers_url":"https://api.github.com/users/ASAAR/followers","following_url":"https://api.github.com/users/ASAAR/following{/other_user}","gists_url":"https://api.github.com/users/ASAAR/gists{/gist_id}","starred_url":"https://api.github.com/users/ASAAR/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ASAAR/subscriptions","organizations_url":"https://api.github.com/users/ASAAR/orgs","repos_url":"https://api.github.com/users/ASAAR/repos","events_url":"https://api.github.com/users/ASAAR/events{/privacy}","received_events_url":"https://api.github.com/users/ASAAR/received_events","type":"User","site_admin":false},"body":"Are there any takeaways you have from working on this problem? Maybe for similar problems?","created_at":"2016-12-01T15:50:20Z","updated_at":"2016-12-01T15:51:31Z","html_url":"https://github.com/asclines/AppliedAlgorithms/pull/22#discussion_r90474215","pull_request_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22","_links":{"self":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/comments/90474215"},"html":{"href":"https://github.com/asclines/AppliedAlgorithms/pull/22#discussion_r90474215"},"pull_request":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22"}}},"pull_request":{"url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22","id":96079967,"html_url":"https://github.com/asclines/AppliedAlgorithms/pull/22","diff_url":"https://github.com/asclines/AppliedAlgorithms/pull/22.diff","patch_url":"https://github.com/asclines/AppliedAlgorithms/pull/22.patch","issue_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/22","number":22,"state":"open","locked":false,"title":"Week 5","user":{"login":"orionkoepke","id":23725093,"avatar_url":"https://avatars.githubusercontent.com/u/23725093?v=3","gravatar_id":"","url":"https://api.github.com/users/orionkoepke","html_url":"https://github.com/orionkoepke","followers_url":"https://api.github.com/users/orionkoepke/followers","following_url":"https://api.github.com/users/orionkoepke/following{/other_user}","gists_url":"https://api.github.com/users/orionkoepke/gists{/gist_id}","starred_url":"https://api.github.com/users/orionkoepke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/orionkoepke/subscriptions","organizations_url":"https://api.github.com/users/orionkoepke/orgs","repos_url":"https://api.github.com/users/orionkoepke/repos","events_url":"https://api.github.com/users/orionkoepke/events{/privacy}","received_events_url":"https://api.github.com/users/orionkoepke/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-12-01T12:30:25Z","updated_at":"2016-12-01T15:51:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c17e3577103029929921207660be2d9d93c621d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22/commits","review_comments_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22/comments","review_comment_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/22/comments","statuses_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/statuses/ba503447f79299ffc270e6b79f04816162758d35","head":{"label":"asclines:Week-5","ref":"Week-5","sha":"ba503447f79299ffc270e6b79f04816162758d35","user":{"login":"asclines","id":4149872,"avatar_url":"https://avatars.githubusercontent.com/u/4149872?v=3","gravatar_id":"","url":"https://api.github.com/users/asclines","html_url":"https://github.com/asclines","followers_url":"https://api.github.com/users/asclines/followers","following_url":"https://api.github.com/users/asclines/following{/other_user}","gists_url":"https://api.github.com/users/asclines/gists{/gist_id}","starred_url":"https://api.github.com/users/asclines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asclines/subscriptions","organizations_url":"https://api.github.com/users/asclines/orgs","repos_url":"https://api.github.com/users/asclines/repos","events_url":"https://api.github.com/users/asclines/events{/privacy}","received_events_url":"https://api.github.com/users/asclines/received_events","type":"User","site_admin":false},"repo":{"id":74715157,"name":"AppliedAlgorithms","full_name":"asclines/AppliedAlgorithms","owner":{"login":"asclines","id":4149872,"avatar_url":"https://avatars.githubusercontent.com/u/4149872?v=3","gravatar_id":"","url":"https://api.github.com/users/asclines","html_url":"https://github.com/asclines","followers_url":"https://api.github.com/users/asclines/followers","following_url":"https://api.github.com/users/asclines/following{/other_user}","gists_url":"https://api.github.com/users/asclines/gists{/gist_id}","starred_url":"https://api.github.com/users/asclines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asclines/subscriptions","organizations_url":"https://api.github.com/users/asclines/orgs","repos_url":"https://api.github.com/users/asclines/repos","events_url":"https://api.github.com/users/asclines/events{/privacy}","received_events_url":"https://api.github.com/users/asclines/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asclines/AppliedAlgorithms","description":"Guides and solutions to various types of programming problems.","fork":false,"url":"https://api.github.com/repos/asclines/AppliedAlgorithms","forks_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/forks","keys_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/teams","hooks_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/hooks","issue_events_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/events{/number}","events_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/events","assignees_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/assignees{/user}","branches_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/branches{/branch}","tags_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/tags","blobs_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/refs{/sha}","trees_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/statuses/{sha}","languages_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/languages","stargazers_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/stargazers","contributors_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/contributors","subscribers_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/subscribers","subscription_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/subscription","commits_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/commits{/sha}","git_commits_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/commits{/sha}","comments_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/comments{/number}","issue_comment_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/comments{/number}","contents_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/contents/{+path}","compare_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/merges","archive_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/downloads","issues_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues{/number}","pulls_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls{/number}","milestones_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/milestones{/number}","notifications_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/labels{/name}","releases_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/releases{/id}","deployments_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/deployments","created_at":"2016-11-25T01:18:13Z","updated_at":"2016-11-28T17:08:26Z","pushed_at":"2016-12-01T12:30:25Z","git_url":"git://github.com/asclines/AppliedAlgorithms.git","ssh_url":"git@github.com:asclines/AppliedAlgorithms.git","clone_url":"https://github.com/asclines/AppliedAlgorithms.git","svn_url":"https://github.com/asclines/AppliedAlgorithms","homepage":null,"size":46,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"base":{"label":"asclines:master","ref":"master","sha":"f8b93d275bd78347c344254f17c30700c8fa2e01","user":{"login":"asclines","id":4149872,"avatar_url":"https://avatars.githubusercontent.com/u/4149872?v=3","gravatar_id":"","url":"https://api.github.com/users/asclines","html_url":"https://github.com/asclines","followers_url":"https://api.github.com/users/asclines/followers","following_url":"https://api.github.com/users/asclines/following{/other_user}","gists_url":"https://api.github.com/users/asclines/gists{/gist_id}","starred_url":"https://api.github.com/users/asclines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asclines/subscriptions","organizations_url":"https://api.github.com/users/asclines/orgs","repos_url":"https://api.github.com/users/asclines/repos","events_url":"https://api.github.com/users/asclines/events{/privacy}","received_events_url":"https://api.github.com/users/asclines/received_events","type":"User","site_admin":false},"repo":{"id":74715157,"name":"AppliedAlgorithms","full_name":"asclines/AppliedAlgorithms","owner":{"login":"asclines","id":4149872,"avatar_url":"https://avatars.githubusercontent.com/u/4149872?v=3","gravatar_id":"","url":"https://api.github.com/users/asclines","html_url":"https://github.com/asclines","followers_url":"https://api.github.com/users/asclines/followers","following_url":"https://api.github.com/users/asclines/following{/other_user}","gists_url":"https://api.github.com/users/asclines/gists{/gist_id}","starred_url":"https://api.github.com/users/asclines/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asclines/subscriptions","organizations_url":"https://api.github.com/users/asclines/orgs","repos_url":"https://api.github.com/users/asclines/repos","events_url":"https://api.github.com/users/asclines/events{/privacy}","received_events_url":"https://api.github.com/users/asclines/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asclines/AppliedAlgorithms","description":"Guides and solutions to various types of programming problems.","fork":false,"url":"https://api.github.com/repos/asclines/AppliedAlgorithms","forks_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/forks","keys_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/teams","hooks_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/hooks","issue_events_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/events{/number}","events_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/events","assignees_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/assignees{/user}","branches_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/branches{/branch}","tags_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/tags","blobs_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/refs{/sha}","trees_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/statuses/{sha}","languages_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/languages","stargazers_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/stargazers","contributors_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/contributors","subscribers_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/subscribers","subscription_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/subscription","commits_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/commits{/sha}","git_commits_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/git/commits{/sha}","comments_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/comments{/number}","issue_comment_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/comments{/number}","contents_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/contents/{+path}","compare_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/merges","archive_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/downloads","issues_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues{/number}","pulls_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls{/number}","milestones_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/milestones{/number}","notifications_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/labels{/name}","releases_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/releases{/id}","deployments_url":"https://api.github.com/repos/asclines/AppliedAlgorithms/deployments","created_at":"2016-11-25T01:18:13Z","updated_at":"2016-11-28T17:08:26Z","pushed_at":"2016-12-01T12:30:25Z","git_url":"git://github.com/asclines/AppliedAlgorithms.git","ssh_url":"git@github.com:asclines/AppliedAlgorithms.git","clone_url":"https://github.com/asclines/AppliedAlgorithms.git","svn_url":"https://github.com/asclines/AppliedAlgorithms","homepage":null,"size":46,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":10,"forks":0,"open_issues":10,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22"},"html":{"href":"https://github.com/asclines/AppliedAlgorithms/pull/22"},"issue":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/22"},"comments":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/issues/22/comments"},"review_comments":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22/comments"},"review_comment":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/pulls/22/commits"},"statuses":{"href":"https://api.github.com/repos/asclines/AppliedAlgorithms/statuses/ba503447f79299ffc270e6b79f04816162758d35"}}}}
{"actor":{"display_login":"ASAAR"}}