words and samples. Say a word w holds a sample s if every letter of s appears in w at least as many times as it does in s (the order of letters does not matter). For example, "ell" fits inside "hello" but not inside "help".
Return every word in words that holds each sample in samples. The words may be returned in any order.words=["banana", "cabin", "nab", "bandana"], samples=["ban", "aa"] → ['banana', 'bandana']
A word needs b, n and two as. banana and bandana have them; cabin and nab have only one a.
words=["stone", "notes", "tones"], samples=["net", "so"] → ['stone', 'notes', 'tones']
All three words are rearrangements of the same letters, and each contains n, e, t, s, o.
words=["loop", "pool"], samples=["ooo"] → []
words=["banana", "cabin", "nab", "bandana"], samples=["ban", "aa"]
['banana', 'bandana']
Run checks the first 3 tests in your browser. Submit checks all 38 tests on the server, hidden ones included.