← Back to challenges

Ransom Letter

PythonHardstringsvalidation

Instructions

Write a function that returns True if you can use the letters of the first string to create the second string. Letters are case sensitive.

Examples

can_build("aPPleAL", "PAL") ➞ True

can_build("aPPleAL", "apple") ➞ False

can_build("a", "") ➞ True

can_build("aa", "aaa") ➞ False

Notes

Letters in the first string can be used only once.

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