← Back to challenges

Scrambled Letters

PythonHardstringsarraysregex

Instructions

Write a function that receives a list of words and a mask. Return a list of words, sorted alphabetically, that match the given mask.

Examples

scrambled([”red”, “dee”, “cede”, “reed”, “creed”, “decree”], “*re**”) ➞ [“creed”]

scrambled([”red”, “dee”, “cede”, “reed”, “creed”, “decree”], “***”) ➞ [“dee”, “ree”]

Notes

The length of a mask will never exceed the length of the longest word in the word list.

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.