What is the maximum number of gifts the uncle can buy for his nephew, given a list of gifts available on specific days with their corresponding prices? The uncle receives 1 unit of currency every day, and the list consists of tuples in the format [day, gift price]. Determine the maximum number of gifts the uncle can purchase with the available amount of money in the bank account.
Asked in the Round 1 stage. A gift can be bought on its listed day, and unused money remains available. Implement max_gifts(gifts), where gifts is a list of [day, price] pairs, and return the maximum number of gifts.
Example: [[1,3],[2,3],[3,2],[4,1],[5,3]] returns 2. Constraints: 1 <= len(gifts) <= 1000, days and prices are positive integers.
def max_gifts(gifts):