#37Festival Wristband Printing
A festival organizer is preparing wristbands for thousands of attendees. Each wristband must contain the same access phrase. You are given: wristbandStock — a collection of lowercase letters available in the printing system. accessPhrase — the text that every wristband must contain.
Letters from wristbandStock can be rearranged freely to create wristband texts. Each letter can be used only once for a single copy, but after creating one wristband, the remaining letters can be used for additional copies. Return the maximum number of complete copies of accessPhrase that can be printed from wristbandStock. If a particular letter is required multiple times in accessPhrase, enough copies of that letter must be available for every wristband.
Real-World Applications: Attendee Wristband Production Event Access Pass Printing Product Label Manufacturing
Examples
Example 1
Input: wristbandStock = "festivalaccesspass"
accessPhrase = "pass"
Output: 1
Explanation: There are enough p, a, and s characters to create two copies.
Example 2
Input: wristbandStock = "abcabcabc"
accessPhrase = "abc"
Output: 3
Explanation: The available letters can create three complete wristbands.
Example 3
Input: wristbandStock = "aaaaab"
accessPhrase = "aa"
Output: 2
Explanation: Five as are available, and each wristband requires two as.
Example 4
Input: wristbandStock = "festival"
accessPhrase = "party"
Output: 0
Explanation: Required characters such as p, r, and y are unavailable.
Constraints
- 1 <= wristbandStock.length <= 100
- 1 <= accessPhrase.length <= 20
- wristbandStock contains only lowercase English letters.
- accessPhrase contains only lowercase English letters.
- Letters may be rearranged freely.
- Every letter used for one wristband is consumed.
- Each wristband must contain exactly one complete copy of accessPhrase.
