-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.java
46 lines (32 loc) · 1.14 KB
/
step.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// import java.util.HashMap;
// import java.util.PriorityQueue;
// class Pair {
// String f;
// int r;
// Pair(String f, int r) {
// this.f = f;
// this.r = r;
// }
// }
// class FoodRatings {
// HashMap<String, PriorityQueue<Pair>> countryToPair = new HashMap<>();
// HashMap<String, String> foodtoCountry = new HashMap<>();
// public FoodRatings(String[] foods, String[] cuisines, int[] ratings) {
// for (int i = 0; i < ratings.length; i++) {
// String key = cuisines[i];
// Pair val = new Pair(foods[i], ratings[i]);
// countryToPair.getOrDefault(key, new PriorityQueue<>((a, b) -> (b.r - a.r))).add(val);
// foodtoCountry.put(foods[i], cuisines[i]);
// }
// }
// public void changeRating(String food, int newRating) {
// String key = foodtoCountry.get(food);
// for (Pair pair : countryToPair.get(key)) {
// if (pair.f == food)
// pair.r = newRating;
// }
// }
// public String highestRated(String cuisine) {
// return countryToPair.get(cuisine).poll().f;
// }
// }