This is why, & amp; How to debug the error to find the problem?
The class Solution1 {
The static bool myCompare (string x, string y) {//descending
Return x + y & gt; Y + x;
}
The static bool MC (string x, string y) {
Return (x + y). Compare (y + x);
}
String largestNumber (vector
Vector
A string of Max;
For (auto iter=nums. The begin (); iter !=nums. End (); Iter++)
NumStr. Push_back (to_string iter) (*).
Sort (numStr. The begin (), numStr end (), myCompare);//an error here!!!!!!!!!!!
A: for (auto numStr) {
Max +=a;
}
If (Max [0]=='0') return "0".
The return of Max;
}
};
CodePudding user response:
Compare not so use it only 0 is equal is other nonzero are true or falseCodePudding user response:
An error could be the negative turn bool guessCodePudding user response:
Sort the comparison function must be a function pointer, a lambda expressions, a function, that each of you nothing, so wrong,Specific baidu STL: : sort comparison function