Question: Description: Given an array A consisting of N elements, find the smallest sum of contiguous elements that is strictly greater than K. Input: First line

 Description: Given an array A consisting of N elements, find the

Description: Given an array A consisting of N elements, find the smallest sum of contiguous elements that is strictly greater than K. Input: First line will contain a single number N, denoting the number of elements in the array A. Second line will contain the N elements of the array. Third line will contain the integer K. Output: Output a single integer S, the minimum sum of contiguous elements that is strictly greater than K. If no sum exists that is strictly greater K, then output -1. Constraints: 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!