Company: Uber_14july
Difficulty: medium
Maximum Sum Problem Description You are given an array arr of size n and an integer k representing the number of sign-flip operations to perform. A sign-flip operation changes the sign of a number (positive to negative or vice versa). Implement a function that calculates the maximum possible sum of the array after performing exactly k sign-flip operations. The function maximizeSum will take two inputs: an integer array arr and an integer k (the total number of sign-flip operations to perform). The function should return the maximum possible sum of the array after performing exactly k flips. A number's sign can be flipped multiple times as long as the total number of flips is exactly k . Examples Example 1: Input: arr = [-5, -2, -3, 6, 7], k = 3 Output: 13 Explanation: The initial sum is (-5) + (-2) + (-3) + 6 + 7 = 3 . To maximize the sum, we should prioritize flipping negative numbers to positive. Flip -5 to 5 . The array becomes [5, -2, -3, 6, 7] . The sum is 5 + (-2) + (-3) + 6 + 7