Codeforces 1411A/1465A - In-game Chat Solution

   Solution in C++:

///**********ALLAH IS ALMIGHTY************///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh  

  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int l,i,n,t,c;
  6. string s;
  7. cin>>t;
  8. while(t--)
  9. {
  10. c=0;
  11. cin>>n;
  12. cin>>s;
  13. for(i=n-1;i>=0;i--)
  14. {
  15. if(s[i]==')')
  16. c++;
  17. else
  18. break;
  19. }
  20. if(c*2>n)
  21. cout<<"Yes"<<endl;
  22. else
  23. cout<<"No"<<endl;
  24. }
  25. }

No comments

Most View Post

Recent post

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.