MCPcopy Create free account
hub / github.com/HuberTRoy/leetCode / Solution

Class Solution

Array/ThirdMaximumNumbers.py:41–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40"""
41class Solution(object):
42 def thirdMax(self, nums):
43 """
44 :type nums: List[int]
45 :rtype: int
46 """
47 nums = set(nums)
48 if len(nums) < 3:
49 return max(nums)
50
51 return sorted(nums, reverse=True)[2]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected