Company: Uber_14july
Difficulty: medium
Maximum Sum Problem Statement You are given an integer array arr of size n and an integer k . A sign-flip operation picks one element of the array and changes its sign: a positive value becomes negative and a negative value becomes positive. Implement the function maximizeSum(arr, k) that returns the maximum possible sum of the array after performing exactly k sign-flip operations. The same element may be flipped any number of times, as long as the total number of flips is exactly k . Input Format The first line contains an integer n , the size of the array. Each of the next n lines contains one integer arr[i] . The last line contains the integer k . Output Format Print a single integer: the maximum possible sum of arr after exactly k sign-flip operations. Constraints 1 <= n <= 15000 (inferred - the source allows n up to 2 * 10^5 , but at that size a worst-case input is 2,400,017 bytes, far over this judge's 200,000-byte input limit; at n = 15000 the largest possible input is 180