Low Level Design, Object Oriented, Graph Data Structure, Hashmap, Interview Questions.
products, remove the # corresponding key and add a new key cat_ids = self.product_categories[prod_id] old_price = self.product_price[prod_id] for cat_id in cat_ids: self.category_products[cat_id].remove((old_price, prod_id)) self.category_products[cat_id].add((price, prod_id)) # Update product