Run #035207af
completedScore
100% (4/4)
Runtime
16μs
vs Previous
No change vs parent
Tied for best
Same as parent
Score
100% (4/4)
Runtime
16μs
vs Previous
No change vs parent
Tied for best
Same as parent
def solve(input):
from itertools import starmap
from operator import sub
if not input:
return []
return [input[0]] + list(starmap(sub, zip(input[1:], input)))Score Difference
Tied
Runtime Advantage
14μs slower
Code Size
8 vs 9 lines
| # | Your Solution | # | Champion |
|---|---|---|---|
| 1 | def solve(input): | 1 | def solve(input): |
| 2 | from itertools import starmap | 2 | if not input: |
| 3 | from operator import sub | 3 | return [] |
| 4 | 4 | result = [input[0]] | |
| 5 | if not input: | 5 | previous = input[0] |
| 6 | return [] | 6 | for current in input[1:]: |
| 7 | 7 | result.append(current - previous) | |
| 8 | return [input[0]] + list(starmap(sub, zip(input[1:], input))) | 8 | previous = current |
| 9 | 9 | return result |
1def solve(input):2 from itertools import starmap3 from operator import sub4 5 if not input:6 return []7 8 return [input[0]] + list(starmap(sub, zip(input[1:], input)))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