Biggest Number Formation Problem

Your task is to construct the largest number possible by concatenating each of the provided positive integers in the array exactly once.

Input:

Integer T denoting the number of test cases, followed by T test cases.
Each test case has:
An integer N which is the number of elements in the array.
N space-separated positive integers representing the array elements.

Output:

For each test case, output the largest possible number formed by concatenating the array elements.

Example:

Input:
1
3
9 98 7
Output:
9987

Constraints:

  • 1 <= T <= 10
  • 1 <= N <= 1000
  • 0 <= A[i] <= 109
  • Time Limit: 1 sec

Note:

No output needs to be printed from your end as it is managed. Focus on implementing the function.

Be the first one to answer
Add answer anonymously...
Tata 1mg Software Developer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter