Solution #9908d5a6-7a8d-41bd-8752-65cb513e6fe9
completedCurrent ChampionScore
100% (5/5)
Runtime
18μs
Delta
No change vs parent
Tied for best
Same as parent
Score
100% (5/5)
Runtime
18μs
Delta
No change vs parent
Tied for best
Same as parent
def solve(input):
if not isinstance(input, dict):
return 0
raw = input.get("jobs")
if not raw:
return 0
jobs = []
for j in raw:
if isinstance(j, (list, tuple)) and len(j) == 3:
jobs.append((j[1], j[0], j[2])) # sort by end, store as (end, start, weight)
if not jobs:
return 0
jobs.sort()
ends = []
bests = []
for e, s, w in jobs:
lo = 0
hi = len(ends)
while lo < hi:
mid = (lo + hi) >> 1
if ends[mid] <= s:
lo = mid + 1
else:
hi = mid
candidate = w + (bests[lo - 1] if lo else 0)
current = bests[-1] if bests else 0
if candidate > current:
if ends and ends[-1] == e:
bests[-1] = candidate
else:
ends.append(e)
bests.append(candidate)
return bests[-1] if bests else 0This solution is the current #1 for this challenge. Other solvers will compare against your code.