标签:nta else should strong amp pre OWIN sig each
完成时间3分06秒
Given an integer size
, return an array containing each integer from 1
to size
in the following order:
1, size, 2, size - 1, 3, size - 2, 4, ...
Example
For size = 7
, the output should beconstructArray(size) = [1, 7, 2, 6, 3, 5, 4]
.
我的解答:
def constructArray(size): l = [] x = 1 for i in range(size): if i % 2 == 0: l.append(x) x += 1 else: l.append(size+2-x) return l
Code Signal_10分钟挑战题_constructArray
标签:nta else should strong amp pre OWIN sig each
原文地址:https://www.cnblogs.com/YD2018/p/9465469.html