Ad
  • Custom User Avatar

    while it is good solution with O(n) complexity, we do not need to import defaultdict, use {} instead --> count = {}

  • Custom User Avatar

    For those still confused about the problem description, I'll try to explain it in simpler terms.

    Imagine a water bottle with a 100% capacity (regardless of its actual volume in milliliters). Let's say that every day, 10% of the water in the bottle evaporates. The question is: on which day will the remaining capacity of the bottle reach a certain threshold?

    Example

    Given:

    Capacity = 100%
    Evaporation per day = 10%
    Threshold = 10%
    

    Find:

    On which day will the remaining capacity of the bottle reach the threshold?

    Example calculation:

    1. Remaining capacity (%) on the first day = 100 - 10% = 100 - 10 = 90%. Does it reach the threshold? 90 <= 10? No.
    2. Remaining capacity (%) on the second day = 90 - 10% = 90 - 9 = 81%. Does it reach the threshold? 81 <= 10? No.
    3. Continue the calculation until the remaining capacity reaches the threshold...
    
  • Custom User Avatar

    Im interested with this solution, yet im not understand tho :D

    can you please explain the flow please