My code is giving the exact output that is needed but still not passing any test case

please correct the code, also can you suggest an easier method for solving this question?

i modified the code a bit, it passes 1 out of 2 test cases, the other one is showing run time error, please correct my code and suggest a less time taking code

https://ide.codingblocks.com/s/622894 still another attempt at a smaller code shows run time error

@aryapandey194_31bab11b21ee53fb just do the question like we do sorting in bubble sort all we need to do is check whether 2 strings are smaller from which one in a custom function
Coding Blocks IDE
this is the implemented code in the sort fucntion we check every character of 2 strings upto the point of min(s1.length(),s2.length()) and then if a diffrent character found then 2 are directly diffrent and if not then we check which one is smaller and we do according to that
if it is clear mark it as resolved and rate my experience

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.

yes, i pretty much understood the whole logic behind the two functions one last doubt what is this line ----> string* str = new string[n]; doing here? why are we declaring it as new string[n] instead of normally declaring string s[n]; also what is the use of new?

Hi Arya,
string* str = new string[n]
this is just dynamic way of declaring a string array… u can do it simply also…

Hi,
Is there still any doubt??

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.