14 August 2026
Best Prize Pair
Hard
Lists
Pick two different prizes without going over budget, then make the total count.
You are given a list of positive prize prices and a budget. Choose two different prizes whose total price is at most the budget. Return the largest total you can afford. Return -1 if no pair of different prizes fits the budget.
Constraints
Each price is a positive integer.0 <= len(prices) <= 200.The budget is a positive integer.
Function signature
def best_pair_total(prices: list[int], budget: int) -> int: