UnknownNames
TC China 08 - Finals · 2008-11-23 · by boba5551
Problem Statement
You are given a
Return a
Constraints
- questionMarkNames will contain between 2 and 50 elements, inclusive.
- Each element of questionMarkNames will containt between 1 and 50 characters, inclusive.
- All elements of questionMarkNames will be of the same length.
- Each character of each element of questionMarkNames will be an uppercase letter ('A'-'Z') or a question mark ('?').
{"?ED?", "TO??", "????"}
Returns: {"AAAA", "AEDA", "TODA" }
If we make the order of names 0 1 2 then the lexicographically earliest ordering is AEDA TODA TODA 0 2 1 AEDA AEDA TOEA 1 0 2 TO?? TED? T??? - IMPOSSIBLE for this order, because O is after E, etc.
{"T???????", "SO??????", "?MP?????", "??OC????", "???BO???", "????MD??", "?????CE?", "??????CR"}
Returns: {"AAAAAACR", "AAAAACER", "AAAAMDER", "AAABODER", "AAOCODER", "AMPCODER", "SOPCODER", "TOPCODER" }
{"??", "??"}
Returns: {"AA", "AA" }
{"IUH?JEUD", "?ERD??EW", "REWEHTQ?"}
Returns: { }
{"IMP?", "OSS?", "IBL?", "EAW?"}
Returns: { }
Submissions are judged against all 82 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class UnknownNames with a public method vector<string> sortNames(vector<string> names) · 82 test cases · 2 s / 256 MB per case