Untitled

 avatar
user_9132356
python
2 years ago
221 B
4
Indexable

def maxScore(popularity):
    N = len(popularity)
    popularity.sort()

    def cook(i=0, j=1):
        if i == N:
            return 0
        return max(cook(i+1, j+1)+popularity[i]*j, cook(i+1, j))

    return cook()