Solution by Ruby


  • 0
    K

    @param {Integer[]} nums

    @return {Integer}

    def third_max(nums)
    list = nums.uniq.sort.reverse
    list.length > 2 ? list[2] : list.first
    end


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.