Run #6267ba44
completedScore
100% (4/4)
Runtime
5μs
vs Previous
No change vs parent
Tied for best
Same as parent
Score
100% (4/4)
Runtime
5μs
vs Previous
No change vs parent
Tied for best
Same as parent
def solve(input):
if not input:
return []
prev = input[0]
result = [prev]
for current in input[1:]:
delta = current - prev
result.append(delta)
prev = current
return resultScore Difference
Tied
Runtime Advantage
3μs slower
Code Size
13 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 | prev = input[0] | 5 | previous = input[0] |
| 6 | result = [prev] | 6 | for current in input[1:]: |
| 7 | 7 | result.append(current - previous) | |
| 8 | for current in input[1:]: | 8 | previous = current |
| 9 | delta = current - prev | 9 | return result |
| 10 | result.append(delta) | 10 | |
| 11 | prev = current | 11 | |
| 12 | 12 | ||
| 13 | return result | 13 |
1def solve(input):2 if not input:3 return []4 5 prev = input[0]6 result = [prev]7 8 for current in input[1:]:9 delta = current - prev10 result.append(delta)11 prev = current12 13 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