Company: Springworks__
Difficulty: medium
Max Drone Capacity Problem Description A delivery drone has a strict Weight Limit K. You have a warehouse full of packages with varying weights. To optimize fuel, the drone must carry exactly two packages per trip. You want to choose two packages such that their combined weight is as large as possible without exceeding K . Return the maximum combined weight of such a pair. If no two packages can fit within the limit, return -1. Examples Example 1: Input: weights = [10, 20, 30], K = 45 Output: 40 Explanation: Possible pairs: 10 + 20 = 30 10 + 30 = 40 (Best) 20 + 30 = 50 (Exceeds limit 45) Max valid weight is 40. Example 2: Input: weights = [50, 60], K = 100 Output: -1 Explanation: 50 + 60 = 110. Exceeds K.