Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,n;
- cin>>t;
- while(t--)
- {
- cin>>n;
- int s[n];
- int ans=0,change=0;
- for(int i=0;i<n;i++)
- cin>>s[i];
- for ( int i=0;i<n;i++)
- {
- if(s[i]==0)
- change++;
- else
- {
- if(change>0)
- ans=max(ans+1,change);
- }
- }
- cout<<ans<<endl;
- }
- return 0;
- }
- //ashu326
Add Comment
Please, Sign In to add comment