5
var maxNumberOfBalloons = function (text) {6
// 1. create hashmap with "balloon" letters7
// 2. keep track of how many letters in text belong to "balloon"8
// 3. account for fact that we need two "l" and "o" per "balloon" instance9
// 4. then select all map values and get the minimum - this will be the max value19
for (const char of text) {20
if (balloonMap[char] !== undefined) {21
balloonMap[char] += 1;25
const letterFreq = [];26
for (const key in balloonMap) {27
if (["l", "o"].includes(key)) {28
letterFreq.push(Math.floor(balloonMap[key] / 2));30
letterFreq.push(balloonMap[key]);33
return Math.min(...letterFreq);