Skip to content

Commit 6aa622a

Browse files
authored
Update plates-between-candles.py
1 parent 88e0106 commit 6aa622a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Python/plates-between-candles.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ def platesBetweenCandles(self, s, queries):
88
:type queries: List[List[int]]
99
:rtype: List[int]
1010
"""
11-
left, prefix = [0]*len(s), [0]*len(s)
11+
left, prefix = [0]*len(s), {}
1212
curr, cnt = -1, 0
1313
for i in xrange(len(s)):
1414
if s[i] == '|':
1515
curr = i
1616
cnt += 1
17+
prefix[i] = cnt
1718
left[i] = curr
18-
prefix[i] = cnt
1919
right = [0]*len(s)
2020
curr = len(s)
2121
for i in reversed(xrange(len(s))):

0 commit comments

Comments
 (0)