Easy Solution | Python
IntuitionApproach
Iterate k times with for loop
Find the minimum value and its index position from the array
Replace the min number with its negation
Repeat thi
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n1. Iterate k times with for loop\n2. Find the minimum value and its index position from the array\n3. Replace the min number with its negation\n4. Repeat this process k times.\n5. Return sum of array\n\n\n# Complexity\n- Time complexity: O(k * n)\n- where k is the interger value and n is the time complexity for finding index postion of small number\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```python3 []\nclass Solution:\n    def largestSumAfterKNegations(self, nums: List[int], k: int) -> int:\n        for _ in range(k):\n            smallest = min(nums)\n            idx_small = nums.index(smallest)\n            nums[idx_small] = -smallest\n        return sum(nums)\n\n```
['Python3']