Created
April 15, 2014 17:51
-
-
Save adamclerk/10752450 to your computer and use it in GitHub Desktop.
RQA Interview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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