<jupyter_start><jupyter_text>https://leetcode.com/problems/water-bottles/<jupyter_code>class Solution:
    def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
        res = numBottles
        def helper(n):
            if n < numExchange:
                return 0
            e = n//numExchange
            left = n%numExchange
            n = e 
            return n + helper(n+left)
        return res + helper(numBottles)
        
class Solution:
    def numWaterBottles(self, numBottles: int, numExchange: int) -> int:
        res = numBottles
        n = numBottles
        while n >= numExchange:
            left = n%numExchange
            n = n // numExchange
            res += n
            n += left
        return res<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09137709137709138, 'fraction_numerical': 0.001287001287001287, 'mean_word_length': 1.7298245614035088, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '316907', 'license': 'MIT', 'n_tokens_mistral': 251, 'n_tokens_neox': 238, 'n_words': 57, 'path': 'lt1518_water_bottles.ipynb', 'repo_name': 'devkosal/code_challenges', 'size': '777'}