FormBiggestNumber

I have checked over all test cases but on submitting it is throwing wrong answer. Please help me out by telling the edge cases for the problem.

Hello @Debugger,

Please, share your code. It will be easier for me to detect the issue.
Your output format would be wrong.

#include<bits/stdc++.h>
using namespace std;

bool compare(string a,string b)
{
return a>b;
}
int main() {
int t;
char ch;
cin>>t;
while(t–)
{
int n;
cin>>n;
int a[n];
string s[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
stringstream str1;
str1<<(a[i]);
s[i] = str1.str();
}
sort(s,s+n,compare);
for(int i=0;i<n;i++)
{
cout<<s[i];
}
cout<<endl;
}
return 0;
}

@S18ML0016 I have Provided please help me out.Thanking you for anticipation. :slight_smile:

Hello @Debugger,

Please, from the next time share it using Online Coding Blocks IDE: https://ide.codingblocks.com/
The way you have send it can introduce some syntax errors.
Steps:

  1. Paste it there.
  2. Save it.
  3. Share the URL generated.

Now, focusing on your code:
Your compare function is failing for the test cases like:
1
2
9 96
Expected Output:
996
Your Output:
969

I have modified your code:

Hope, this would help.
Give a like if you are satisfied.