Skip to content

Commit 102e9ba

Browse files
committed
Runtime: 492 ms (Top 22.46%) | Memory: 20 MB (Top 17.02%)
1 parent ea165e1 commit 102e9ba

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Runtime: 492 ms (Top 22.46%) | Memory: 20 MB (Top 17.02%)
12
class Solution:
23
def isPossible(self, target: List[int]) -> bool:
34
if len(target) == 1:
@@ -8,13 +9,13 @@ def isPossible(self, target: List[int]) -> bool:
89
while heap[0]<-1:
910
maximum = -heappop(heap)
1011
res -= maximum
11-
12+
1213
if res == 1:
1314
return True
1415
x = maximum % res
1516
if x == 0 or (x != 1 and x == maximum):
1617
return False
17-
18+
1819
res += x
1920
heappush(heap,-x)
20-
return True
21+
return True

0 commit comments

Comments
 (0)