StringInterspersal
SRM 414 · 2008-08-16 · by StevieT
Problem Statement
A
DE SIGN
A LG O RI THM
MA RA THON
-----------------------
ADELGMAORARISIGNTHMTHON
Given a
Notes
- The lexicographically minimum of two Strings is the one with the alphabetically earlier character at the first position at which they differ.
- The return String will contain no more than 1000 characters.
Constraints
- W will contain between 1 and 20 elements, inclusive.
- Each element of W will contain between 1 and 50 uppercase letters ('A'-'Z'), inclusive.
{"DESIGN","ALGORITHM","MARATHON"}
Returns: "ADELGMAORARISIGNTHMTHON"
The example from the problem statement.
{"BA","B","BA","B","BA"}
Returns: "BABABABB"
{"TOMEK","PETR","ACRUSH","BURUNDUK","KRIJGERTJE"}
Returns: "ABCKPERIJGERRTJETOMEKTRURUNDUKUSH"
{"CCCA","CCCB","CCCD","CCCE"}
Returns: "CCCACCCBCCCCCCDE"
{"BKSDSOPTDD","DDODEVNKL","XX","PODEEE","LQQWRT"}
Returns: "BDDKLODEPODEEEQQSDSOPTDDVNKLWRTXX"
Submissions are judged against all 129 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class StringInterspersal with a public method string minimum(vector<string> W) · 129 test cases · 2 s / 256 MB per case