practivceAlgorithm/codeforce
[codeforce][Python] #690 A. Favorite Sequence
findTheValue
2021. 12. 7. 22:11
좌우영역에서 검사하는 것으로 투포인터를 이용했습니다.
import sys
input = sys.stdin.readline
for test in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
left, right = 0, n - 1
answer = []
while left <= right:
answer.append(arr[left])
if left == right:
break
answer.append(arr[right])
left += 1
right -= 1
print(*answer)