Search⌘ K
AI Features

Solution: Grumpy Bookstore Owner

C# solution for the Grumpy Bookstore Owner problem using the Sliding Window pattern.

We'll cover the following...

Statement

You are given two integer arrays customers and grumpy, each of length n, and an integer minutes. For each index i, customers[i] is the number of customers that enter the bookstore during minute i. If grumpy[i] equals 11, the owner is grumpy during minute i and all customers in that minute are unsatisfied. If grumpy[i] equals 00, the owner is not grumpy and all customers in that minute are satisfied.

The owner can use a secret technique exactly once to avoid being grumpy for a consecutive window of minutes minutes. During that chosen window, customers are satisfied regardless of the values in grumpy.

Return the maximum total number of satisfied customers that can be achieved.

Constraints:

  • n == customers.length == grumpy.length

  • 11 \leq ...