Skip to content

Latest commit

 

History

History
21 lines (12 loc) · 405 Bytes

README.md

File metadata and controls

21 lines (12 loc) · 405 Bytes

Smallest subarray with a sum greater than X

Given an array of integers and a number X, can you find the smallest subarray with sum greater than the given value? If there isn't a possible subarray, print "Not possible." For example:

arr[] = {1, 4, 45, 6, 0, 19}

   x  =  51

Output: 3

# the array is {4, 45, 6}

arr[] = {1, 10, 5, 2, 7}

   x  = 9

Output: 1

# the array is {10}