Skip to content

Latest commit

 

History

History

water-bottles-ii

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Water bottles ii

Problem link

Solutions

Solution.py

# https://leetcode.com/problems/water-bottles-ii/

class Solution:
    def maxBottlesDrunk(self, bottles: int, exchange: int) -> int:
        ret = bottles
        while bottles >= exchange:
            ret += 1
            bottles -= exchange - 1
            exchange += 1
        return ret

Tags