1005. Maximize Sum Of Array After K Negations - notruilin/LeetCode GitHub Wiki

may choose the same index i multiple times

Firstly, reverse all x negative values, K -= x if K is even, do nothing (we can reverse the same value even times) if K is odd, reverse the smallest value