
A mobile team at PulseApp logs each data retrieval attempt as the number of records fetched and the time taken in milliseconds. Write a function to calculate the application's retrieval efficiency, defined as the maximum whole-number rate of records / second across all valid attempts.
A retrieval attempt is valid only if its duration is greater than 0 milliseconds. For each valid attempt, compute:
efficiency = floor(records * 1000 / duration_ms)
Return the highest efficiency among all valid attempts. If there are no valid attempts, return 0.
records: a list of non-negative integers where records[i] is the number of records fetched in attempt idurations: a list of integers where durations[i] is the time in milliseconds for attempt iExample 1
records = [100, 200, 150], durations = [1000, 500, 750]400100, 400, and 200 records/second, so the maximum is 400.Example 2
records = [50, 80], durations = [0, 200]4000. The second gives floor(80 * 1000 / 200) = 400.1 <= len(records) <= 10^5len(records) == len(durations)0 <= records[i] <= 10^90 <= durations[i] <= 10^9records = [100, 200, 150], durations = [1000, 500, 750]Output400WhyThe efficiencies are 100, 400, and 200 records/second. The maximum is 400.records = [50, 80], durations = [0, 200]Output400WhyThe first attempt is ignored because its duration is 0. The second attempt gives 400 records/second.records = [0, 10], durations = [100, 1000]Output10WhyThe efficiencies are 0 and 10, so the maximum valid efficiency is 10.1 <= len(records) <= 10^5len(records) == len(durations)0 <= records[i] <= 10^90 <= durations[i] <= 10^9def calculate_retrieval_efficiency(records, durations):