Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 507 Bytes

2591.md

File metadata and controls

20 lines (18 loc) · 507 Bytes

2591. Distribute Money to Maximum Children

Solution 1 (time O(1), space O(1))

class Solution(object):
    def distMoney(self, money, children):
        """
        :type money: int
        :type children: int
        :rtype: int
        """
        if money < children:
            return -1
        if money > 8 * children:
            return children - 1
        if money == 8 * children - 4:
            return children - 2
        return (money - children) // 7