Aaagmnrs
SRM 204 · 2004-07-21 · by vorthys
Problem Statement
Two phrases are anagrams if they are permutations of each other, ignoring spaces and capitalization.
For example, "Aaagmnrs" is an anagram of "anagrams", and "TopCoder" is an anagram
of "Drop Cote". Given a
Constraints
- phrases contains between 2 and 50 elements, inclusive.
- Each element of phrases contains between 1 and 50 characters, inclusive.
- Each element of phrases contains letters ('a'-'z' and 'A'-'Z') and spaces (' ') only.
- Each element of phrases contains at least one letter.
Statement by TopCoder, Inc. — view the original on the archive.
{ "Aaagmnrs", "TopCoder", "anagrams", "Drop Cote" }
Returns: { "Aaagmnrs", "TopCoder" }
The examples above.
{ "SnapDragon vs tomek", "savants groped monk", "Adam vents prongs ok" }
Returns: { "SnapDragon vs tomek" }
{ "Radar ghost jilts Kim", "patched hers first",
"DEPTH FIRST SEARCH", "DIJKSTRAS ALGORITHM" }
Returns: { "Radar ghost jilts Kim", "patched hers first" }
{ "q", "q" }
Returns: { "q" }
{ "Q", "q" }
Returns: { "Q" }
Submissions are judged against all 57 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Aaagmnrs with a public method vector<string> anagrams(vector<string> phrases) · 57 test cases · 2 s / 256 MB per case