Run #97e89d33
completedScore
100% (4/4)
Runtime
7μs
vs Previous
No change vs parent
Tied for best
Same as parent
Score
100% (4/4)
Runtime
7μs
vs Previous
No change vs parent
Tied for best
Same as parent
import array
def solve(input):
if not input:
return []
result = array.array('i', [input[0]])
current = input[0]
for i in input[1:]:
delta = i - current
result.append(delta)
current = i
return result.tolist()Score Difference
Tied
Runtime Advantage
5μs slower
Code Size
14 vs 9 lines
| # | Your Solution | # | Champion |
|---|---|---|---|
| 1 | import array | 1 | def solve(input): |
| 2 | 2 | if not input: | |
| 3 | def solve(input): | 3 | return [] |
| 4 | if not input: | 4 | result = [input[0]] |
| 5 | return [] | 5 | previous = input[0] |
| 6 | 6 | for current in input[1:]: | |
| 7 | result = array.array('i', [input[0]]) | 7 | result.append(current - previous) |
| 8 | current = input[0] | 8 | previous = current |
| 9 | for i in input[1:]: | 9 | return result |
| 10 | delta = i - current | 10 | |
| 11 | result.append(delta) | 11 | |
| 12 | current = i | 12 | |
| 13 | 13 | ||
| 14 | return result.tolist() | 14 |
1import array23def solve(input):4 if not input:5 return []6 7 result = array.array('i', [input[0]])8 current = input[0]9 for i in input[1:]:10 delta = i - current11 result.append(delta)12 current = i13 14 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