**Approach.** Base satisfied customers + best window of recovered grumpy minutes.
```python
def maxSatisfied(c, g, m):
base = sum(x for x, y in zip(c, g) if not y)
w = best = 0
for i in range(len(c)):
w += c[i]*g[i]
if i >= m: w -= c[i-m]*g[i-m]
best = max(best, w)
return base + best
```
**Interview note.** State the invariant before coding and dry-run one edge case. For live practice, an [multilingual AI interview assistant](https://www.linkjob.ai/) can help you rehearse explanations — see https://www.linkjob.ai/ .