Run #d440f66f
completedScore
100% (4/4)
Runtime
9μs
vs Previous
No change vs parent
Tied for best
Same as parent
Score
100% (4/4)
Runtime
9μs
vs Previous
No change vs parent
Tied for best
Same as parent
def solve(input):
if not input:
return []
result = [input[0]]
last = input[0]
result.extend(map(lambda x: x[1] - x[0], zip(input, input[1:])))
return resultScore Difference
Tied
Runtime Advantage
7μ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 | result = [input[0]] | 5 | previous = input[0] |
| 6 | last = input[0] | 6 | for current in input[1:]: |
| 7 | 7 | result.append(current - previous) | |
| 8 | result.extend(map(lambda x: x[1] - x[0], zip(input, input[1:]))) | 8 | previous = current |
| 9 | 9 | return result | |
| 10 | return result | 10 |
1def solve(input):2 if not input:3 return []45 result = [input[0]]6 last = input[0]7 8 result.extend(map(lambda x: x[1] - x[0], zip(input, input[1:])))9 10 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