How the return part is working in this

int myCompare(string X, string Y)
{
// first append Y at the end of X
string XY = X.append(Y);

// then append X at the end of Y 
string YX = Y.append(X); 

// Now see which of the two formed numbers is greater 
return XY.compare(YX) > 0 ? 1: 0; 

}

here XY.compare(YX) returns 1 if XY>YX else -1 if XY<YX else 0.
the result is checked by if condition and depending on it 1 or 0 is returned

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.