Given an array of integers, nums, and an integer k, find the maximum sum of two elements in nums less than k. Otherwise, return −1 if no such pair exists.
Constraints:
1≤ nums.length ≤100
1≤ nums[i] ≤103
1≤ k ≤103
This solution uses the following approaches to find the maximum of the two values, which is less than k.
Sorting: The array is first sorted in ...