{"action":"created","issue":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/9037","repository_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp","labels_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/9037/labels{/name}","comments_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/9037/comments","events_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/9037/events","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/9037","id":159228671,"number":9037,"title":"Test case conflicts with description","user":{"login":"johnhuichen","id":15637790,"avatar_url":"https://avatars.githubusercontent.com/u/15637790?v=3","gravatar_id":"","url":"https://api.github.com/users/johnhuichen","html_url":"https://github.com/johnhuichen","followers_url":"https://api.github.com/users/johnhuichen/followers","following_url":"https://api.github.com/users/johnhuichen/following{/other_user}","gists_url":"https://api.github.com/users/johnhuichen/gists{/gist_id}","starred_url":"https://api.github.com/users/johnhuichen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnhuichen/subscriptions","organizations_url":"https://api.github.com/users/johnhuichen/orgs","repos_url":"https://api.github.com/users/johnhuichen/repos","events_url":"https://api.github.com/users/johnhuichen/events{/privacy}","received_events_url":"https://api.github.com/users/johnhuichen/received_events","type":"User","site_admin":false},"labels":[{"id":199835579,"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/labels/discussing","name":"discussing","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-06-08T17:40:44Z","updated_at":"2017-01-04T06:36:13Z","closed_at":null,"body":"<!-- FreeCodeCamp Issue Template -->\n\n<!-- NOTE: ISSUES ARE NOT FOR CODE HELP - Ask for Help at https://gitter.im/FreeCodeCamp/Help -->\n\n<!-- Please provide as much detail as possible for us to fix your issue -->\n\n<!-- Remove any heading sections you did not fill out -->\n#### Challenge Name\n\nhttps://www.freecodecamp.com/challenges/pairwise\n#### Issue Description\n\n<!-- Describe below when the issue happens and how to reproduce it -->\n\nThe challenge description says that \"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.\"\n\nSo for pairwise([0, 0, 0, 0, 1, 1], 1) this should produce a result of 4 (0 + 4) and not 10\n#### Browser Information\n\n<!-- Describe your workspace in which you are having issues-->\n- Browser Name, Version: \n- Operating System: \n- Mobile, Desktop, or Tablet: \n#### Your Code\n\nfunction pairwise(arr, arg) {\n  var pairs;\n  var result;\n\n  pairs = arr.reduce( function(previous, current, index, array){\n    var values;\n    var notFound;\n\n```\nfor( var i = 0; i < arr.length; i++ ){\n  if( i === index ){\n    continue;\n  }\n\n  if( arr[i]+arr[index] === arg ){\n    values = [ Math.min( arr[i], arr[index] ), Math.max( arr[i], arr[index] ) ];\n    notFound = true; \n    for( var j = 0; j < previous.length; j++ ){\n      if( previous[j][0][0] === values[0] &&\n        previous[j][0][1] === values[1] ){  // if same pair is found\n\n        notFound = false;\n\n        if( previous[j][1] > i+index ){  // if new sum is smaller, update it\n          previous[j][1] = i+index;\n        }\n\n        break;\n      }\n    }\n    if( notFound ){\n      previous.push( [values, i+index] ); \n    } \n    break;\n  }\n}\n\nreturn previous;\n```\n\n  }, []);\n\n  result = pairs.reduce( function(previous, current, index, array){\n    return previous + current[1];\n  }, 0);\n\n  return result;\n}\n\npairwise([0, 0, 0, 0, 1, 1], 1);\n#### Screenshot\n\n<!-- Add a screenshot of your issue -->\n"},"comment":{"url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/comments/270304134","html_url":"https://github.com/FreeCodeCamp/FreeCodeCamp/issues/9037#issuecomment-270304134","issue_url":"https://api.github.com/repos/FreeCodeCamp/FreeCodeCamp/issues/9037","id":270304134,"user":{"login":"QuincyLarson","id":985197,"avatar_url":"https://avatars.githubusercontent.com/u/985197?v=3","gravatar_id":"","url":"https://api.github.com/users/QuincyLarson","html_url":"https://github.com/QuincyLarson","followers_url":"https://api.github.com/users/QuincyLarson/followers","following_url":"https://api.github.com/users/QuincyLarson/following{/other_user}","gists_url":"https://api.github.com/users/QuincyLarson/gists{/gist_id}","starred_url":"https://api.github.com/users/QuincyLarson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/QuincyLarson/subscriptions","organizations_url":"https://api.github.com/users/QuincyLarson/orgs","repos_url":"https://api.github.com/users/QuincyLarson/repos","events_url":"https://api.github.com/users/QuincyLarson/events{/privacy}","received_events_url":"https://api.github.com/users/QuincyLarson/received_events","type":"User","site_admin":false},"created_at":"2017-01-04T06:36:13Z","updated_at":"2017-01-04T06:36:13Z","body":"@erictleung it looks like you didn't get around to making this copy change to the Pairwise challenge copy. Do you still think this is a change worth making?"}}
{"actor":{"display_login":"QuincyLarson"}}