Codeforces 1291A. Even But Not Even Solution

///**********ALLAH IS ALMIGHTY************///
///AH Tonmoy
///Department of CSE,23rd Batch
///Islamic University,Bangladesh
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    long long n,i,c1=0,t;
    string s;
    cin>>t;
    while(t--)
    {
        c1=0;
        vector<int> v;
        cin>>n>>s;
        for(i=0; i<n; i++)
        {
            if(s[i]%2==1)
            {
                c1++;
                v.push_back(i);
            }
        }
            if(c1<2)
                cout<<"-1"<<endl;
            else
            {
                cout<<s[v[0]]<<s[v[1]]<<endl;
            }
        v.erase(v.begin(),v.end());
    }
}

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.