Math, asked by Aquamarine8030, 11 months ago

Given an array arr[] of size n containing integers. The problem is to find the length of the longest contiguous sub-array having sum equal to aur less than the given value k.

Answers

Answered by Anonymous
5

 \large\boxed{\underline{\mathcal{\red{A}\green{n}\pink{s}\orange{w}\blue{e}\red{r:}}}}

Given an array of integers and a number x, find the smallest subarray with sum greater than the given value.

Examples:

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

x = 51

Output: 3

Minimum length subarray is {4, 45, 6}

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

x = 9

Output: 1

Minimum length subarray is {10}

arr[ ] = {1, 11, 100, 1, 0, 200, 3, 2, 1, 250}

x = 280

Output: 4

Minimum length subarray is {100, 1, 0, 200}

arr[ ] = {1, 2, 4}

x = 8

Output : Not Possible

Whole array sum is smaller than 8.

Answered by Anonymous
1

Answer:

Given an array of integers and a number x, find the smallest subarray with sum greater than the given value.

Examples:

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

x = 51

Output: 3

Minimum length subarray is {4, 45, 6}

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

x = 9

Output: 1

Minimum length subarray is {10}

arr[ ] = {1, 11, 100, 1, 0, 200, 3, 2, 1, 250}

x = 280

Output: 4

Minimum length subarray is {100, 1, 0, 200}

arr[ ] = {1, 2, 4}

x = 8

Output : Not Possible

Whole array sum is smaller than 8.

Similar questions