We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int t;
cin>>t;
for(int i=0;i>n;
int a[200005];
for(int k=0;k>a[k];
}
int flag=0;
for(int k=0;k

## Sherlock and Array

You are viewing a single comment's thread. Return to all comments →

## include

## include

## include

## include

## include

using namespace std;

int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */

int t; cin>>t; for(int i=0;i>n; int a[200005]; for(int k=0;k>a[k]; } int flag=0; for(int k=0;k

}

This is my code... Failing test case 3 and 4 due to time out.Kindly help.

yours code complexity is o(n^2).It can be solved in o(n).

how?