Skip to content

Commit ed8c29e

Browse files
authored
Merge pull request #3317 from kaushikdaiv7/main
Create: 2483-minimum-penalty-for-a-shop.py
2 parents ea50b24 + 0a78ffa commit ed8c29e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution:
2+
def bestClosingTime(self, customers: str) -> int:
3+
4+
curPenalty = res = minPenalty = 0
5+
6+
for i, ele in enumerate(customers):
7+
if ele == 'Y':
8+
curPenalty -= 1
9+
if curPenalty < minPenalty:
10+
res = i+1
11+
curPenalty = minPenalty
12+
else:
13+
curPenalty += 1
14+
15+
return res

0 commit comments

Comments
 (0)