logo

Back to questions

Salary Inequity [Microsoft Python Interview Question]

Easy

Given a list of salaries, we'll define a metric called which is the difference between max and min salary seen in the list:

inequity=max(input_list)min(input_list) \text{inequity} = max(\text{input\_list}) - min(\text{input\_list})

Write a function called which takes in a list of salaries, and a value , and returns the minimum inequity possible when taking salaries from the full salary list.

If that was hard to understand, you're not alone – let's break it down with some examples.

Example #1:

The minimum inequity is $10,000, because max(60000,70000)min(60000,70000)=10000 max(60000, 70000) - min(60000, 70000) = 10000.

Example #2:

The minimum inequity is $20,000, because max(60000,70000,80000)min(60000,70000,80000)=20000max(60000, 70000, 80000) - min(60000, 70000,80000) = 20000.

Python