You are given an array of N integer A1,A2,...,AN.
Task
You need to tell the difference between the maximum subsequence sum and minimum subsequence sum, both consisting of at least one element.
Notes
A subsequence of an array is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements.
A subsequence sum is the sum of all elements present in the subsequence.
Function description
Complete the solve function provided in the editor. This function takes the following 2 parameters and returns the difference between the maximum subsequence sum and minimum subsequence sum, both consisting of at least one element:
Input format
Note: This is the input format that you must use to provide custom input (available above the Compile and Test button)
Output Format:
For each test Case, print one integer denoting the difference in maximum subsequence sum and minimum subsequence sum.
Constraints :
1≤T≤10
1≤N≤10000
−10000≤Ai≤10000
Code snippets (also called starter code/boilerplate code)
This question has code snippets for C, CPP, Java, and Python.
NA