Company: Autodesk_10april
Difficulty: medium
Highest Rating Price Ratio Item Problem Description You are given two arrays of positive integers containing information about some items on the market - one with their prices, and the second with their ratings (from 1 to 5). Where prices[i] corresponds to the price of the i th item, and ratings[i] corresponds to the rating of the i th item. Find the item with the highest ratio of rating / price and return its index. If this ratio is equal across multiple items, return the item with the lowest index. Note: You are not expected to provide the most optimal solution, but a solution with time complexity not worse than O(prices.length) will fit within the execution time limit. Examples Example 1: Input: prices = [7, 5, 2, 11], ratings = [3, 4, 1, 3] Output: 1 Explanation: 3 / 7 is approximately 0.43 4 / 5 is approximately 0.80 1 / 2 is approximately 0.50 3 / 11 is approximately 0.27 The highest ratio is 4 / 5 for the item at index 1 . So the answer is 1 . Example 2: Input: prices = [6, 5, 4