You are viewing a single comment's thread. Return to all comments →
Great solution! Here is my take on it!
function main() { var n = parseInt(readLine()); var unsorted = []; for(var unsorted_i = 0; unsorted_i < n; unsorted_i++){ unsorted[unsorted_i] = readLine(); } console.log(unsorted.sort(function(a,b){ return bigIntSort(a,b); }).join("\n")); } function bigIntSort(a,b){ if(a.length!=b.length){ return a.length>b.length?1:-1; } a_ar = a.split(""); b_ar = b.split(""); for(var i=0; i<a_ar.length; i++){ if(a_ar[i] != b_ar[i]) { return a_ar[i]>b_ar[i]?1:-1; } } return 0; }
Big Sorting
You are viewing a single comment's thread. Return to all comments →
Great solution! Here is my take on it!