Skip to content

Commit 124bc46

Browse files
authored
Update 1189-maximum-number-of-balloons.js
removing includes method.
1 parent dd4f143 commit 124bc46

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Diff for: javascript/1189-maximum-number-of-balloons.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@
44
var maxNumberOfBalloons = function(text) {
55

66
const balloonCach = {};
7+
const ballonSet = new Set();
8+
for(let i = 0; i < text.length; i++) {
9+
ballonSet.add(text[i]);
10+
}
711

812
for(let i = 0; i < text.length; i++) {
9-
if('balloon'.includes(text[i])) {
13+
if(ballonSet.has(text[i])) {
1014
if(balloonCach[text[i]]) {
1115
balloonCach[text[i]] += 1;
1216
} else {

0 commit comments

Comments
 (0)