I have given two input description given for two different problems in codeforces.
Description-1:-
Each test consists of multiple test cases. The first line contains a single integer t (1≤t≤104) — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer n (2≤n≤105) — the length of the array a.
The second line of each test case contains n integers a1,a2,…,an(0≤ai<n) — the elements of the array a.
It is guaranteed that the sum of n over all test cases does not exceed 105.
Description-2:-
The first line contains a single integer t (1≤t≤5⋅104) — the number of test cases.
The only line of each test case contains a single integer n (1≤n≤105).
Here my doubt is can we perform O(n) on both the questions or not and performing O(n) operations on 1st one is getting me TLE. So how should i approach questions based on their complexity?
How important is this line in 1st input description:- It is guaranteed that the sum of n over all test cases does not exceed 105.