HTMLify

LeetCode - Largest Positive Integer That Exists With Its Negative - Python
Views: 64 | Author: abh
class Solution:
    def findMaxK(self, nums: List[int]) -> int:
        nums.sort()
        l = -1
        for n in nums:
            if n < 0:
                continue
            if -n in nums:
                if n > l:
                    l = n
        return l

Comments