Single Pass Using Hash Set | Python
Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\n# Code\n\nclass Solution:\n    def findMaxK(self, nums: List[int]) -> int:\n        seen = se
# Complexity\n- Time complexity: O(n)\n\n- Space complexity: O(n)\n\n# Code\n```\nclass Solution:\n    def findMaxK(self, nums: List[int]) -> int:\n        seen = set()\n        ans = -float(\'inf\')\n\n        for num in nums:\n            if abs(num)>ans and -num in seen:\n                ans = abs(num)\n            seen.add(num)\n\n        return -1 if ans==-float(\'inf\') else ans\n\n        \n```
['Array', 'Hash Table', 'Python', 'Python3']