Search⌘ K
AI Features

Arrange the Largest Number

Understand how to arrange integers in an array to form the largest possible number by converting them to strings and sorting with a custom comparator. Explore the sorting logic based on concatenated pairs and handle edge cases like arrays filled with zeros to prepare for coding interviews.

Statement

Given an array of integers, find the largest number that can be made by creating all possible permutations of these integers.

As the largest number formed can be very large, Return a string instead of an integer.

Example

Let’s suppose an array with two numbers [3,21][3, 21].

We can only create two permutations with these two numbers and the largest number formed is 321321 ...