[Python] min heap + max heap
\nclass Solution:\n    def kSum(self, nums: List[int], k: int) -> int:\n        \n        sum1 = sum(num for num in nums if num > 0)\n        min_q, max_q, q = 
```\nclass Solution:\n    def kSum(self, nums: List[int], k: int) -> int:\n        \n        sum1 = sum(num for num in nums if num > 0)\n        min_q, max_q, q = [0], [0], []\n\n        for num in islice(sorted(map(abs, nums)), k-1):\n            v = min_q[0]\n            if len(max_q) == k and v > - max_q[0]:\n                break      \n            \n            while min_q:\n                v = heappop(min_q)\n                q.append(v)\n                w = v + num\n                if len(max_q) == k and w > - max_q[0]:\n                    break\n                heappush(max_q, -w)\n                if len(max_q) > k:\n                    heappop(max_q)\n                q.append(w)\n                \n            while q:\n                heappush(min_q, q.pop())\n\n        return sum1 + max_q[0]   \n```
[]