Steve would like to buy a new car. He isn't wealthy, so he would prefer a reasonably cheap car. The only problem is that the quality of the cheapest cars is... let's say questionable.
Thus Steve decided to make a list of car prices and to buy a car with the third lowest price.
You will be given a int[] prices.
The same price may occur multiple times in prices, but it should count only once in the ordering of available prices. See Example 1 for further clarification.
Write a function that returns the third lowest price in this list. If there are less than three different car prices in prices, your method should return -1.
|