Advertisement
mfgnik

Untitled

Apr 3rd, 2020
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. def total_time(heroes: list, n: int):
  2.     heroes.reverse()
  3.     current = []
  4.     for _ in range(n):
  5.         heapq.heappush(current, heroes.pop())
  6.     while heroes:
  7.         x = heapq.heappop(current)
  8.         heapq.heappush(current, x + heroes.pop())
  9.     return max(current)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement