##
Sum of minimum and maximum elements of all subarrays of size k.
January 4, 2017

Given an array of both positive and negative integers, the task is to compute sum of minimum and maximum elements of all sub-array of size k. Examples: Input : arr[] = {2, 5, -1, 7, -3, -1, -2} K = 4 Output : 18 Explanation : Subarrays of size 4 are : {2, 5, -1,… Read More »