Answer:
Under last in, first out (LIFO) inventory method, the units purchased last are used to determine the cost of goods sold. This doesn't mean that exactly the last units purchased will be sold first, it is just used as an accounting tool.
In this case, the last unit purchased costed $20, and the immediately previous one costed $15. Under LIFO, these 2 units would have been sold (COGS = $35), and the ending inventory = $10 (the price of the "oldest" unit).