Leetcode 1683 Solution
This article provides solution to leetcode question 1683 (maximum-number-of-coins-you-can-get)
Access this page by simply typing in "lcs 1683" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/maximum-number-of-coins-you-can-get
Solution
class Solution:
def maxCoins(self, piles: List[int]) -> int:
piles.sort(reverse=True)
i = 1
cnt = 0
ans = 0
while cnt < len(piles) // 3:
ans += piles[i]
cnt += 1
i += 2
return ans