Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The key to solving this problem is to properly store the data using the right data structures.
Firstly, a hash table is needed to efficiently map each food item to its cuisine and current rating.
In addition, another hash table is needed to map cuisines to foods within each cuisine stored in an ordered set according to their ratings.