Merge pull request #7798 from erictleung/fix/clarify-pairwise-instructions

Clarify Pairwise instructions
pull/7727/merge
Rex Schrader 2016-04-05 11:46:47 -07:00
commit 4ff2abbae1
1 changed files with 6 additions and 3 deletions

View File

@ -405,9 +405,12 @@
"id": "a3f503de51cfab748ff001aa",
"title": "Pairwise",
"description": [
"Return the sum of all element indices of array <code>arr</code> that can be paired with one other element to form a sum that equals the value in the second argument <code>arg</code>. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.",
"For example, <code>pairwise([1, 4, 2, 3, 0, 5], 7)</code> should return <code>11</code> because 4, 2, 3 and 5 can be paired with each other to equal 7 and their indices (1, 2, 3, and 5) sum to 11.",
"<code>pairwise([1, 3, 2, 4], 4)</code> would only return <code>1</code>, because only the first two elements can be paired to equal 4, and the first element has an index of 0!",
"Given an array <code>arr</code>, find element pairs whose sum equal the second argument <code>arg</code> and return the sum of their indices.",
"If multiple pairs are possible that have the same numeric elements but different indices, return the smallest sum of indices. Once an element has been used, it cannot be reused to pair with another.",
"For example <code>pairwise([7, 9, 11, 13, 15], 20)</code> returns <code>6</code>. The pairs that sum to 20 are <code>[7, 13]</code> and <code>[9, 11]</code>. We can then write out the array with their indices and values.",
"<table class=\"table\"><tr><th><b>Index</b></th><th>0</th><th>1</th><th>2</th><th>3</th><th>4</th></tr><tr><td>Value</td><td>7</td><td>9</td><td>11</td><td>13</td><td>15</td></tr></table>",
"Below we'll take their corresponding indices and add them.",
"7 + 13 = 20 &#8594; Indices 0 + 3 = 3<br>9 + 11 = 20 &#8594; Indices 1 + 2 = 3<br>3 + 3 = 6 &#8594 Return <code>6</code>",
"Remember to use <a href='//github.com/FreeCodeCamp/freecodecamp/wiki/How-to-get-help-when-you-get-stuck' target='_blank'>Read-Search-Ask</a> if you get stuck. Try to pair program. Write your own code."
],
"challengeSeed": [