Generating the maximum number possible from an array
Your algorithm is good, but the implementation is a bit wasteful:


In IntOrdering.compare, x and y are converted to String twice, and then converted to Int


It's especially bad since the numbers in the sequence may pass through compare multiple times in different pairs, and get converted to String even more times

You could reduce the casts:


Convert all numbers to String once in the beginning
Compare as strings. The algorithm will work with alphabetical comparison too
Convert to Long once at the end

Creating a custom Ordering seems a bit overkill


This one-liner will do the job:

nums.map(_.toString).sortWith(
  (a, b) =&gt; (a concat b).compareTo(b concat a) &gt; 0).mkString.toLong