Zig Zag Sequence

  • + 1 comment

    i have got the same expected result as the output, still saying u failed. i just dont why ?

    • def findZigZagSequence(a, n):
    • a.sort()
    • mid = int((n + 1)//2)-1
    • a[mid], a[n-1] = a[n-1], a[mid]
    • c=a[:mid+1]
    • b=sorted(a[mid+1:],reverse=True)
    • a=c+b
    • print(" ".join(map(str, a)))
      • test_cases = int(input())
    • "
    • for cs in range (test_cases):
    • n = int(input())
    • a = list(map(int, input().split()))
    • findZigZagSequence(a, n)