Python O(n)
Complexity\n- Time complexity: O(nlog2n))\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def findMaxK(self, nums: List[int]) -> int:\n        d = {
# Complexity\n- Time complexity: O(nlog<sub>2</sub>n))\n- Space complexity: O(n)\n\n# Code\n```\nclass Solution:\n    def findMaxK(self, nums: List[int]) -> int:\n        d = {}\n        for i in nums:\n            d[i] = d.get(i, 0)+1\n        \n        ans = -1\n        for i in sorted(d.keys()):\n            if i<0:\n                continue\n            elif i>0 and -i in d:\n                ans = i\n        \n        return ans\n```\n--------\n**Upvote the post if you find it helpful.\nHappy coding.**
['Python3']