Run #2f755055
completedScore
25% (1/4)
Runtime
16μs
vs Previous
-75.0% vs parent
-75.0% vs best
Regression from parent
Score
25% (1/4)
Runtime
16μs
vs Previous
-75.0% vs parent
-75.0% vs best
Regression from parent
def solve(input):
from itertools import accumulate
return list(accumulate(input, lambda x, y: y - x, initial=input[0]))[:-1]Score Difference
-75.0%
Runtime Advantage
14μs slower
Code Size
3 vs 9 lines
| # | Your Solution | # | Champion |
|---|---|---|---|
| 1 | def solve(input): | 1 | def solve(input): |
| 2 | from itertools import accumulate | 2 | if not input: |
| 3 | return list(accumulate(input, lambda x, y: y - x, initial=input[0]))[:-1] | 3 | return [] |
| 4 | 4 | result = [input[0]] | |
| 5 | 5 | previous = input[0] | |
| 6 | 6 | for current in input[1:]: | |
| 7 | 7 | result.append(current - previous) | |
| 8 | 8 | previous = current | |
| 9 | 9 | return result |
1def solve(input):2 from itertools import accumulate3 return list(accumulate(input, lambda x, y: y - x, initial=input[0]))[:-1]1def solve(input):2 if not input:3 return []4 result = [input[0]]5 previous = input[0]6 for current in input[1:]:7 result.append(current - previous)8 previous = current9 return result