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 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
Get step-by-step solutions from verified subject matter experts
