question is not clear , need more examples and output to understand , and alsp pls explain this question using examples
Can you give more examples
what will be answer for
5
1 2 3 2 1
also tell all subarays
1
1 2
1 2 3
2
2 3
3
3 2
3 2 1
2
2 1
1
output 19