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.
- All Contests
- HourRank 15
- Gaming Array
- Discussions
Gaming Array
Gaming Array
Sort by
recency
|
11 Discussions
|
Please Login in order to post a comment
Can be solved in O(n), but O(nlogn) works fine as in LIS.
linear time complexity
Time out in last three case my C++ code is int findMaxIndex(vector a,int n) { int c=INT_MIN,index; for(int i=0;ic) { c=a[i]; index=i; } } return index; } int main(){ int g,count; cin >> g; for(int a0 = 0; a0 < g; a0++){ int n; count=0; cin >> n; vector a(n); for(int i=0;i>a[i]; } while(n!=0) { n=findMaxIndex(a,n); count=count+1; } if(count%2==0) cout<<"ANDY\n"; else cout<<"BOB\n"; } return 0; } any body can explian me , why ?
I just the Editorial. It has the same logic I used but still code is being timeout. what must be the reason?
timeout in last four test cases. in my python code. i don't know what is wrong. can any one help me?