/*******************************************************
* Copyright (C) 2015 Haotian Wu
*
* This file is the solution to the question:
* https://www.hackerrank.com/challenges/sherlock-and-array
*
* Redistribution and use in source and binary forms are permitted.
*******************************************************/
#include
#include
#include
#include
#include
using namespace std;
// We can traverse all possible i's, then calculate the sum of numbers to it's left & right.
// However this a an O(N^2) approach. We can do better when computing the sum.
// There are several ways of doing this.
int main() {
int tt;
scanf("%d",&tt);
while (tt--)
{
int n;
scanf("%d",&n);
int arr[100000];
for (int i=0;i