Find largest no possible by array nos

sir I was not able to find a proper method to approach this problem
thought of extracting each element of each digit and comparing but found it to be very exhaustive
morever there is no method to stick to elements of array together(a[i]a[i+n]) to form a number as append is for a string of arrays.Please help

@Megha2468 This problem must be solved using string comparators.

@Megha2468 You should sort the strings by comparison of two merged strings and take whichever is larger.
First read about Boolean comparators.

please correct my code

@Megha2468 What is the error that you are facing? I can see that you have implemented it right. Also as you are very close to the solution I would recommend you to get this solution AC yourself :blush:

sir I am getting correct answer when the values are inputted in different lines .when i am inputting the values in same line then answer is not coming right

@Megha2468 enter a cin as well because it happens there when you take integer input just after string input. Your curser wait for the null character. And misses the integer input.

sir I have entered cin.get() but it is not having any difference in output

@Megha2468 Can you send me your updated code


sir I have used cin.get() before getline but facing same problem

@Megha2468 You are trying to sort 1 string an not the array of strings for that you have to loop through n strings and then sort.

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.