Run #b9b06941
completedScore
100% (4/4)
Runtime
10μs
vs Previous
No change vs parent
Tied for best
Same as parent
Score
100% (4/4)
Runtime
10μs
vs Previous
No change vs parent
Tied for best
Same as parent
def solve(input):
if not input:
return []
from itertools import pairwise
result = [input[0]]
for a, b in pairwise(input):
result.append(b - a)
return resultScore Difference
Tied
Runtime Advantage
8μs slower
Code Size
10 vs 9 lines
| # | Your Solution | # | Champion |
|---|---|---|---|
| 1 | def solve(input): | 1 | def solve(input): |
| 2 | if not input: | 2 | if not input: |
| 3 | return [] | 3 | return [] |
| 4 | 4 | result = [input[0]] | |
| 5 | from itertools import pairwise | 5 | previous = input[0] |
| 6 | result = [input[0]] | 6 | for current in input[1:]: |
| 7 | for a, b in pairwise(input): | 7 | result.append(current - previous) |
| 8 | result.append(b - a) | 8 | previous = current |
| 9 | 9 | return result | |
| 10 | return result | 10 |
1def solve(input):2 if not input:3 return []45 from itertools import pairwise6 result = [input[0]]7 for a, b in pairwise(input):8 result.append(b - a)910 return result1def 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