Given an array and a number. We have to find the maximum sum of two numbers from an array which is less than the given number.
Answers
Answered by
0
Step-by-step explanation:
Naive Approach: We can find maximum sum of subarray by running two loops. But the time complecxity will be O(N*N). Efficient Approach: The subarray having maximum sum can be found by using sliding window. If curr_sum is less than sum include array elements to it.
Similar questions