Problem statement

https://binarysearch.com/problems/Beer-Bottles/

Solution

We can directly find answer here. Or we can simulate process.

Complexity

It is O(1) for time and space

Code

class Solution:
    def solve(self, n):
        return n + (n - 1)//2 if n else 0