问题描述:
Given an array nums of integers and integer k, return the maximum sum such that there exists i < j with nums[i] + nums[j] = sum and sum < k. If no i, j exist satisfying this equation, return -1.
暴力算法写了为了练习,但明显不是最好的办法,在这里就不贴了。
方法一:先排序,再按照第167题的模式写,这里就不重复了,在leetcode写过一遍当复习。