this is my solution link:-link

my approach in this question is first adding index of elements of array which have adjacent strictly greater elements in priorityQueue which will prioritize them according to value of elements at that index.so, elements greater than other will be first polled out from queue.then for each element in list i check it is possible to do negation of item or not.

i am unable to solve minimum sum possible part…in start i think by negation of bigger value elemnts will automatically give minimum sum but as from verdict WA i think i am wrong.so, i need help in minimumSum part which i think can be implemented using DP but not able to implement.