Connection Status:
Competition Arena > LetterSet
SRM 105 · 2002-07-18 · by Azot · String Manipulation
Class Name: LetterSet
Return Type: String
Method Name: compliment
Arg Types: (vector<string>)
Problem Statement

Problem Statement

Write a method which, given a String[] over the alphabet 'A'-'Z', figures out the set of letters that are not present in the String's and orders them alphabetically.

Constraints

  • str contains between 0 to 50 elements, inclusive.
  • Each element of str contains between 1 and 50 characters, inclusive.
  • Each element of str contains only the capital letters 'A'-'Z'.
Examples
0)
{}
Returns: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1)
{"ABCDEFGHIJKLMNOPQRSTUVWXYZ"}
Returns: ""
2)
{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Returns: ""
3)
{"NATURAL", "SPRING", "NATRUAL", "WATER"}
Returns: "BCDFHJKMOQVXYZ"
4)
{"E", "EE", "EEEE", "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE"}
Returns: "ABCDFGHIJKLMNOPQRSTUVWXYZ"

Submissions are judged against all 25 archived test cases, of which 5 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class LetterSet with a public method string compliment(vector<string> str) · 25 test cases · 2 s / 256 MB per case

Submitting as anonymous