HTMLify
LeetCode - Take Gifts From the Richest Pile - Python
Views: 372 | Author: abh
1 2 3 4 5 6 | 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) |