Skip to content

Instantly share code, notes, and snippets.

@adamclerk
Created April 15, 2014 17:51
Show Gist options
  • Save adamclerk/10752450 to your computer and use it in GitHub Desktop.
Save adamclerk/10752450 to your computer and use it in GitHub Desktop.
RQA Interview
#!/usr/bin/env node
var _ = require('underscore');
var main = function (input) {
input = _.sortBy(input);
var result = [];
for(var i = 0; i < input.length; i++){
var num = input[i];
for(var j = i+1; j < input.length; j++){
var altnum = input[j];
if(num + altnum === 100){
result.push([num, altnum]);
j = input.length;
}
}
}
return result;
}
var input = [51, 1, 27, 50, 49, 51, 99, 51, 51];
var result = main(input);
console.log(result);
----------------
SELECT UNIQUE account_id FROM account_pricing_plans WHERE pricing_plan_id = {0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment