Run #11a1d8c7
completedScore
100% (4/4)
Runtime
6μs
vs Previous
No change vs parent
Tied for best
Same as parent
Score
100% (4/4)
Runtime
6μs
vs Previous
No change vs parent
Tied for best
Same as parent
def solve(input):
if not input:
return []
output = [input[0]]
append = output.append
get_input = input.__getitem__
for i in range(1, len(input)):
append(get_input(i) - get_input(i - 1))
return outputScore Difference
Tied
Runtime Advantage
4μs slower
Code Size
9 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 | output = [input[0]] | 4 | result = [input[0]] |
| 5 | append = output.append | 5 | previous = input[0] |
| 6 | get_input = input.__getitem__ | 6 | for current in input[1:]: |
| 7 | for i in range(1, len(input)): | 7 | result.append(current - previous) |
| 8 | append(get_input(i) - get_input(i - 1)) | 8 | previous = current |
| 9 | return output | 9 | return result |
1def solve(input):2 if not input:3 return []4 output = [input[0]]5 append = output.append6 get_input = input.__getitem__7 for i in range(1, len(input)):8 append(get_input(i) - get_input(i - 1))9 return output1def 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