Skip to content

Commit 165c759

Browse files
committed
Runtime: 576 ms (Top 96.50%) | Memory: 85.2 MB (Top 90.21%)
1 parent 224d811 commit 165c759

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

scripts/algorithms/D/Design a Food Rating System/Design a Food Rating System.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 576 ms (Top 96.50%) | Memory: 85.2 MB (Top 90.21%)
12
var FoodRatings = function(foods, cuisines, ratings) {
23
this.heaps = {}, this.foods = {};
34
let n = foods.length;
@@ -8,7 +9,7 @@ var FoodRatings = function(foods, cuisines, ratings) {
89
})
910
this.heaps[cuisine].add([food, rating]);
1011
this.foods[food] = { cuisine, rating };
11-
}
12+
}
1213
};
1314

1415
FoodRatings.prototype.changeRating = function(food, newRating) {
@@ -18,7 +19,7 @@ FoodRatings.prototype.changeRating = function(food, newRating) {
1819
};
1920

2021
FoodRatings.prototype.highestRated = function(cuisine) {
21-
let heap = this.heaps[cuisine];
22+
let heap = this.heaps[cuisine];
2223
while (this.foods[heap.top()[0]].rating !== heap.top()[1]) {
2324
heap.remove();
2425
}
@@ -74,4 +75,4 @@ class PriorityQueue {
7475
isEmpty() {
7576
return this.size === 0;
7677
}
77-
}
78+
}

0 commit comments

Comments
 (0)