#1E-commerce — Product Price Pair
You are building an e-commerce shopping assistant.
You are given an array of integers prices, where prices[i] represents the price of the ith product, and an integer budget representing the customer's total budget.
Find two different products whose prices add up exactly to the customer's budget.
Return the indices of those two products.
Rules Each input contains exactly one valid pair. You cannot select the same product twice. The order of the returned indices does not matter. Products are not necessarily sorted by price. Multiple products may have the same price. Prices may include 0 for free/promotional items.
Examples
Example 1
Input: prices = [40,25,60,15]
budget = 100
Output: [0,2]
Explanation: prices[0] + prices[2] = 40 + 60 = 100.
Example 2
Input: prices = [15,35,20,50]
budget = 55
Output: [0,1]
Explanation: 15 + 35 = 55.
Constraints
- 2 <= prices.length <= 10^4
- 0 <= prices[i] <= 10^9
- 0 <= budget <= 10^9
- Exactly one valid pair exists.
- The two selected products must have different indices.
