Maximum Pizza Slices Hao Can Eat
Preview mode. Log in to edit, run, submit, and save progress.
Easy
Maximum Pizza Slices Hao Can Eat
Hao and Alex start with n pizza slices. Each day, if at most 2 slices remain, Alex eats them all. Otherwise, Hao splits the current slices into three non-empty groups m1, m2, and m3 such that m1 <= m2 <= m3. Hao eats m1 slices, Alex eats m2 slices, and m3 slices remain for the next day. Return the maximum total number of slices Hao can eat.
Examples
Example 1
Input:
3
Output:
1
Explanation: Hao can split the pizza as 1, 1, 1 and eat 1 slice.
Approach hint
On every day Hao eats no more slices than Alex.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
solution.cpp