Problem :
How many
subsets of a given array sum to zero?
Largest sum subarray with at-least k numbers
Given an array, find the subarray (containing at least k numbers) which has the largest sum.
Examples:
Input : arr[] = {-4, -2, 1, -3}
k = 2
Output : -1
The sub array is {-2, 1}
Input : arr[] = {1, 1, 1, 1, 1, 1}
k = 2
Output : 6
The sub array is {1, 1, 1, 1, 1, 1}
Asked in : Facebook
Problem
Problem 2
Maximum element from each subarray of size k
Problem :
Find maximum (or minimum) sum of a subarray of size k
Given an array of integers and a number k, find maximum sum of a subarray of size k.
Examples :
Input : arr[] = {100, 200, 300, 400} k = 2 Output : 700 Input : arr[] = {1, 4, 2, 10, 23, 3, 1, 0, 20} k = 4 Output : 39 We get maximum sum by adding subarray {4, 2, 10, 23} of size 4. Input : arr[] = {2, 3} k = 3 Output : Invalid There is no subarray of size 3 as size of whole array is 2.
Problem :
Smallest subarray with sum greater than a given value | GeeksforGeeks
OR
Find Minimum Length Sub Array With Sum K
Find the maximum sum of subset of size K in an array
Given an array
(may have negative num) and an integer(may be negative), find the smallest
subarray whose sum is >= the given integer.
int[] nums2 =
{5,4,-8,16};
return 1, because
16 >= x
-->
No comments:
Post a Comment