pile. You may take letters from it in any order and assemble words from them; each letter in the pile can be used only once.
Return how many complete copies of the word word you can assemble.pile="banananab", word="nab" → 2
The pile has 2 b's, 4 a's and 3 n's. Each copy of nab uses one of each, and the b's run out after two copies.
pile="abc", word="aa" → 0
The word needs two a's, but the pile has only one.
pile and word consist of lowercase English letterspile="banananab", word="nab"
2
Run checks the first 3 tests in your browser. Submit checks all 118 tests on the server, hidden ones included.