python heap
```\nclass Solution:\n    def kSum(self, nums: List[int], k: int) -> int:\n        max_sum = sum([n for n in nums if n > 0])\n        ns = sorted([abs(n) for n 
```\nclass Solution:\n    def kSum(self, nums: List[int], k: int) -> int:\n        max_sum = sum([n for n in nums if n > 0])\n        ns = sorted([abs(n) for n in nums])\n        \n        h = [(ns[0], 0)]\n        val = 0\n        for _ in range(k - 1):\n            val, i = heapq.heappop(h)\n            if i < len(ns) - 1:\n                heapq.heappush(h, (val + ns[i + 1], i + 1))\n                heapq.heappush(h, (val + ns[i + 1] - ns[i], i + 1))\n        return max_sum - val
['Greedy', 'Heap (Priority Queue)', 'Python']