# Binod And Subarray SOLUTIONS BINARR

Page Contents

### Binod And Subarray SOLUTIONS BINARR

Binod is a youtuber and he is occupied in the acclaim of web-based media so he requested that you assist him with tackling an issue. You have been given a variety of

positive numbers a1,a2,a3,…,ai,…,an of size n.You need to locate the littlest length of the subarray with the end goal that the length of the subarray must be carefully more noteworthy than k and it’s total likewise should be carefully more prominent than s.

Information Format :-

The primary line of information contains three space-isolated whole numbers n, k and s

The subsequent line contains n space-isolated integers,describing the cluster a

Yield Format:

Print a solitary whole number :- The littlest length of subarray if exists, Otherwise print “- 1” (without cites)

Limitations:-

1≤n,k≤106

1≤a1,a2,a3,…,ai,…,an≤109

1≤s≤1015

1≤n,k≤103

Unique Constraints

Test Cases:-

Model 1:

5 1 5

1 2 3 4 5

Yield :

Clarification

Record begins at 3 and closures at 4 have a total of 7 which is carefully more noteworthy than 5 and has a length of subarray more prominent than 2.

List begins at 4 and closures at 5 have a total of 9 which is carefully more noteworthy than 5 and has a length of subarray more prominent than 2.

Any of the potential situations offers a similar response.

Model 2:

3 2 1

9 1

Yield :

3

Clarification :

Each incentive in exhibit record fulfills the condition whole more noteworthy than 1 however to fulfill the state of length more prominent than 2 pick the subarray of length 3

CODE PYTHON 3.6 :

n,k,s =map(int,input().split())
arr = list(map(int,input().split()))
k+=1

rlt=i=0
while i<n+1-k:
if sum(arr[i:i+k])>s:
rlt=k
print(rlt)
break
i+=1
if i>=n+1-k:
i=0
k+=1
if rlt==0:
print(-1)