The Visa Developer Center may need to display products from multiple companies in a balanced order. Given several companies and their products, return product names ordered by descending rating within each company, while selecting products in round-robin order across companies.
Process companies from index 0 through n - 1. In each round, select the next highest-rated remaining product from every company that still has products. Continue until all products have been selected. If ratings are equal within one company, preserve their original input order.
Implement round_robin_products(companies), where companies is a list of companies, and each company is a list of products represented as [product_name, rating]. Return a list of product names. The input list must not be modified.
def round_robin_products(companies):