1716. Calculate Money in Leetcode Bank

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1716

class Solution:
    def totalMoney(self, n: int) -> int:
        a, b = divmod(n, 7)
        return (28 + 28 + 7 * (a - 1)) * a // 2 + (a * 2 + b + 1) * b // 2