Beer Bottles
You are given an integer n representing n full beer bottles. Given that you can exchange 3 empty beer bottles for 1 full beer bottle, return the number of beer bottles you can drink.
Constraints
0 ≤ n < 2 ** 31
https://binarysearch.com/problems/Beer-Bottles
Examples
Example 1
Input
- n =
9
Output
- answer =
13
Explanation
- In first round, we drink
9beer bottles. - We can exchange the
9empty ones for3beer bottles. - We can exchange the
3empty ones for1beer bottle.
Leave a comment