Skip to content

Commit ab970b1

Browse files
committed
1052
1 parent 319f67a commit ab970b1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Jun-21-24.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class Solution:
2+
def maxSatisfied(self, customers: List[int], grumpy: List[int], m: int) -> int:
3+
initSat = 0
4+
n = len(customers)
5+
for i in range(n):
6+
if grumpy[i]!=1:
7+
initSat += customers[i]
8+
i,j = 0,m
9+
extraSat = []
10+
while j<=n:
11+
cust = 0
12+
for x in range(i,j):
13+
if grumpy[x]==1:
14+
cust += customers[x]
15+
extraSat.append(cust)
16+
i += 1
17+
j += 1
18+
return initSat+max(extraSat)

0 commit comments

Comments
 (0)