Skip to content

Commit 32c6d87

Browse files
authored
updated description of anagrams exercise (#1928)
* updated description of anagrams * changed anagram description to be one-sentence-per-line * updated description of anagrams to use sets
1 parent d137db1 commit 32c6d87

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

exercises/anagram/description.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# Description
22

3-
An anagram is a rearrangement of letters to form a new word.
4-
Given a word and a list of candidates, select the sublist of anagrams of the given word.
3+
An anagram is a rearrangement of letters to form a new word: for example `"owns"` is an anagram of `"snow"`.
4+
A word is not its own anagram: for example, `"stop"` is not an anagram of `"stop"`.
55

6-
Given `"listen"` and a list of candidates like `"enlists" "google"
7-
"inlets" "banana"` the program should return a list containing
8-
`"inlets"`.
6+
Given a target word and a set of candidate words, this exercise requests the anagram set: the subset of the candidates that are anagrams of the target.
7+
8+
The target and candidates are words of one or more ASCII alphabetic characters (`A`-`Z` and `a`-`z`).
9+
Lowercase and uppercase characters are equivalent: for example, `"PoTS"` is an anagram of `"sTOp"`, but `StoP` is not an anagram of `sTOp`.
10+
The anagram set is the subset of the candidate set that are anagrams of the target (in any order).
11+
Words in the anagram set should have the same letter case as in the candidate set.
12+
13+
Given the target `"stone"` and candidates `"stone"`, `"tones"`, `"banana"`, `"tons"`, `"notes"`, `"Seton"`, the anagram set is `"tones"`, `"notes"`, `"Seton"`.

0 commit comments

Comments
 (0)