HTMLify

LeetCode - Take Gifts From the Richest Pile - Python
Views: 25 | Author: abh
class Solution:
    def pickGifts(self, gifts: List[int], k: int) -> int:
        for _ in range(k):
            m = max(gifts)
            gifts[gifts.index(m)] = int(m**(1/2))
        return sum(gifts)

Comments