Created
August 11, 2018 17:27
-
-
Save amulyakashyap09/83bc05428d76ee35c22cb22b58ca4835 to your computer and use it in GitHub Desktop.
micro_block_game
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
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