Gary Lai
  • Home
  • About
Sign in Subscribe

1133. Largest Unique Number

Last updated on  Apr 4, 2025

1133. Largest Unique Number

class Solution:
    def largestUniqueNumber(self, nums: List[int]) -> int:
        nums.sort()
        
        table = defaultdict(int)
        
        for num in nums:
            table[num] += 1
        
        res = -1
        for key, val in table.items():
            if val == 1:
                res = max(res, key)
        
        return res
Previous 2225. Find Players With Zero or One Losses
Next 1189. Maximum Number of Balloons
Gary Lai © 2025
  • Sign up
Powered by Ghost