Run #d59501cf
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
from array import array
def solve(input):
result = array('i', [input[0]])
prev = input[0]
for current in input[1:]:
result.append(current - prev)
prev = current
return result.tolist()Score Difference
Tied
Runtime Advantage
7μs slower
Code Size
9 vs 9 lines
| # | Your Solution | # | Champion |
|---|---|---|---|
| 1 | from array import array | 1 | def solve(input): |
| 2 | 2 | if not input: | |
| 3 | def solve(input): | 3 | return [] |
| 4 | result = array('i', [input[0]]) | 4 | result = [input[0]] |
| 5 | prev = input[0] | 5 | previous = input[0] |
| 6 | for current in input[1:]: | 6 | for current in input[1:]: |
| 7 | result.append(current - prev) | 7 | result.append(current - previous) |
| 8 | prev = current | 8 | previous = current |
| 9 | return result.tolist() | 9 | return result |
1from array import array23def solve(input):4 result = array('i', [input[0]])5 prev = input[0]6 for current in input[1:]:7 result.append(current - prev)8 prev = current9 return result.tolist()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