← Back to challenges

Letters Formed from the Longest Word

PythonHardstringsvalidation

Instructions

Write a function that returns True if all the strings in a list can be formed by using only the characters from the longest string.

Examples

can_form(["mast", "manifest", "met", "fan"]) ➞ True

can_form(["may", "master", "same", "reams"]) ➞ False

can_form(["may", "same", "reams", "mastery"]) ➞ True

Notes

There will only be one unique longest string.

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