CustomerStatistics
SRM 287 · 2006-02-04 · by misof
Problem Statement
You will be given a
Your method should return the report as a
Constraints
- customerNames contains between 1 and 50 elements, inclusive.
- Each element of customerNames contains between 1 and 50 characters, inclusive.
- Each element of customerNames contains uppercase letters ('A'-'Z') only.
{"JOHN", "BOB", "JOHN", "BILL", "STANLEY", "JOHN"}
Returns: {"JOHN 3" }
The only repeated name is JOHN, and it occurs three times.
{"YETTI", "YETTI", "YETTI", "BIGFOOT", "BIGFOOT"}
Returns: {"BIGFOOT 2", "YETTI 3" }
Note the sorting order.
{"ANDREW", "BILL", "CINDY", "DOH", "ERGH", "FOO", "GOO", "HMPH"}
Returns: { }
No repeated names this time.
{"THEONLYCUSTOMER"}
Returns: { }
Again, no repeats.
{"A", "B", "A", "C", "A", "B", "A", "D", "D", "D"}
Returns: {"A 4", "B 2", "D 3" }
Submissions are judged against all 94 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class CustomerStatistics with a public method vector<string> reportDuplicates(vector<string> customerNames) · 94 test cases · 2 s / 256 MB per case