Form the biggest number

on the ide platfrom the code is running perfectly fine but here it shows wrong answer. Where is the fault?

@rahul.aggarwal000005 please share the code.

1 Like

Shared please check and please let me know where i am getting wrong

@rahul.aggarwal000005 where did you share the code?

#include
#include
#include
using namespace std;
int main()
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int a[n];
string set[n];
for(int i=0;i<n;i++){
cin>>a[i];
set[i]=to_string(a[i]);
}
sort(set,set+n);
for(int i=n-1;i>=0;i–){
cout<<set[i];
}
cout<<endl;
}

}

@rahul.aggarwal000005 please share the code by saving it on ide.codingblocks.com

i have saved my code on the ide with title 'form the biggest number '.

@rahul.aggarwal000005 you need to copy the url generated and share it here as I dont have access to your saved codes.

@rahul.aggarwal000005 your logic is incorrect. For strings like “90 9009”, the expected answer is “909009” but your answer will be “900990”. You can use a custom comparator for sorting.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.