My solution with python but TimeError~!


  • 0
    W
    class Solution(object):
        def findRelativeRanks(self, nums):
            NUM = copy.deepcopy(nums)
            NUM = sorted(NUM, reverse=True)
            Len = len(nums)
            c = [None]*Len
            k,= 0
            for i in range(Len):
                for j in range(Len):
                    if NUM[j] == nums[i]:
                        c[k] = str(j+1)
                        k+=1
            for x in range(Len):
                if c[x] == '1': c[x] = 'Gold Medal'
                if c[x] == '2': c[x] = "Silver Medal"
                if c[x] == '3': c[x] ="Bronze Medal"
            return c
    

Log in to reply
 

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