Skip to content

Instantly share code, notes, and snippets.

@amulyakashyap09
Created August 11, 2018 17:27
Show Gist options
  • Save amulyakashyap09/83bc05428d76ee35c22cb22b58ca4835 to your computer and use it in GitHub Desktop.
Save amulyakashyap09/83bc05428d76ee35c22cb22b58ca4835 to your computer and use it in GitHub Desktop.
micro_block_game
function main(input) {
var inputs=input.split(" ");
function comp(a,b){
console.log("a, b : ", a, b)
var ab=a.concat(b);
var ba=b.concat(a);
console.log("ab, ba : ", ab, ba)
if(ab>ba)
return -1;
else if(ba>ab)
return 1;
else
return 0;
}
inputs.sort(comp);
console.log(inputs)
console.log(inputs.toString().replace(/,/gi,""));
}
main("12 2 3")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment