The TransCompilator

Solved LeetCode program · 813 of 1,000

#1052 · Grumpy Bookstore Owner

Medium Array chunk-17.md

Original English source

The customers is a list of 1, 0, 1, 2, 1, 1, 7, and 5. The moods is a list of 0, 1, 0, 1, 0, 1, 0, and 1. The minutes is 3. The last is 7. The base is 0.
For every spot from 0 to last.
The amount is item spot of customers. If item spot of moods is 0, add amount to base.

The best is 0.
For every start from 0 to last minus minutes plus 1.
The extra is 0.
For every step from 0 to minutes minus 1.
The spot is start plus step. The amount is item spot of customers. If item spot of moods is 1, add amount to extra. If extra is more than best, set best to extra.

The answer is base plus best. Show answer.

Open in Playground Browse all 1,000 problems

Expected stdout

16