← 返回 bloomberg 的题目列表Spelling Bee Valid Words Finder
类型:online_judge
bloomberg
Spelling Bee Game
In the Spelling Bee game, you need to list all words that satisfy the following rules:
The word must be at least 4 letters long.
The required letter must appear at least once.
Optional letters can appear any number of times (repeats allowed).
No other letters are allowed.
For example, with N as the required letter and V, C, O, D, E, Y as optional letters, valid words include: ENCODE, NONCE, DONE, NODE.
Please write a function to complete this task and provide test cases.
Example
Input
required = 'O', optionals = ['G', 'L', 'E', 'P', 'T', 'N'], dictionary = {'POLE', 'TONE', 'TOLL', 'GONE', 'NOTE', 'TOGG', 'ONG', 'TROPEN', 'LENTO', 'LOPE'}