Hiring process8 levels
  1. 1 IQ Test
  2. 2 Additional Online Test (If Required)
  3. 3 Office Interview with Hiring Manager
  4. 4 Unpaid Test Task (Motivation Check)
  5. 5 Paid Test Task and Follow-Up Interview
  6. 6 Iterative Paid Test Tasks
  7. 7 Office Verification
  8. 8 Final Interview with the Founder

Problems > Largest Concatenation > Editorial

Largest Concatenation — Solution & Editorial

Back to the Problem

Sort with the comparator: x before y iff the string x+y > y+x. This order is total and transitive, and any out-of-order adjacent pair could be swapped to improve — the exchange argument.

Complexity: O(N log N · |digits|)

Watch out: Comparing numerically (9 < 10) is wrong: 9 must come before 10 because 910 > 109. Also collapse the all-zero case to a single 0.