๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.63K subscribers
5.61K photos
3 videos
95 files
10.6K links
๐ŸšฉMain Group - @SuperExams
๐Ÿ“Job Updates - @FresherEarth

๐Ÿ”ฐAuthentic Coding Solutions(with Outputs)
โš ๏ธDaily Job Updates
โš ๏ธHackathon Updates & Solutions

Buy ads: https://telega.io/c/cs_algo
Download Telegram
#include<bits/stdc++.h>
using namespace std;
string str, bad_string;
struct node{
    bool end_mark;
    node *next[10];
    node()
    {
        end_mark = false;
        for(int i = 0; i<10; i++)
            next[i] = NULL;
    }
}*root;
bool add(string s)
{
    node *current = root;
    for(int i = 0; i<s.size(); i++)
    {
        int nw = s[i] - 'a';
        if(i == (s.size()-1) && current->next[nw] != NULL)
            return false;
        if(current->next[nw] == NULL)
            current->next[nw] = new node();
        current = current->next[nw];
        if(current->end_mark)
            return false;
    }
    current->end_mark = true;
    return true;
}

int main()
{
    int i, N;
    bool ok = true;
    cin >> N;
    root = new node();
    for(i = 1; i<=N; i++)
    {
        cin >> str;
        if(!ok)
            continue;
        ok = add(str);
        if(!ok)
            bad_string = str;
    }
    if(ok)
        printf("GOOD SET\n");
    else
    {
        printf("BAD SET\n");
        cout << bad_string << endl;
    }
}

Good Bad String
Uber โœ…
๐Ÿ‘1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include<bits/stdc++.h>
using namespace std;

int main() {
    int n,c,d ;
    cin>>n>>c>>d ;
    int b[n],p[n],t[n] ;
    for(int i=0;i<n;i++)
        cin>>b[i]>>p[i]>>t[i] ;
    vector<pair<int,int>>type_0,type_1 ;
    for(int i=0;i<n;i++)
    {
        if(t[i]==0)
        {
            type_0.push_back({p[i],b[i]}) ;
        }
        else
        {
            type_1.push_back({p[i],b[i]}) ;
        }
    }
    sort(type_0.begin(),type_0.end()) ;
    sort(type_1.begin(),type_1.end()) ;
    // One using coins and one using diamonds
    int max_0=0,max_1=0 ;
    int x=type_0.size() ;
    int y=type_1.size() ;
    for(int i=0;i<x;i++)
    {
        if(type_0[i].first<=c)
            max_0=max(max_0,type_0[i].second) ;
    }
    for(int i=0;i<y;i++)
    {
        if(type_1[i].first<=d)
            max_1=max(max_1,type_1[i].second) ;
    }
    int ans=0 ;
    if(max_0&&max_1)
        ans=max(ans,max_0+max_1) ;  
    // Both using coins
    multiset<int>m;                        
    for(int i=0;i<x;i++)
    {
       m.insert(type_0[i].second) ;
    }
    int j=type_0.size()-1 ;
    for(int i=0;i<x;i++)
    {
        if(j<=i)
            break ;
        auto it=m.find(type_0[i].second) ;
        m.erase(it) ;
        int flag=0 ;   
        while(j>i)
        {
            if(type_0[j].first+type_0[i].first<=c)
            {
                flag=1 ;
                break ;
            }
            auto it=m.find(type_0[j].second) ;
            m.erase(it) ;
            j-- ;
        }
        if(flag==0)
            break ;
        if(m.size())
        ans=max(ans,type_0[i].second+*m.rbegin()) ;  
    }
    // Both using diamonds
    m.clear() ;
    for(int i=0;i<y;i++)
    {
       m.insert(type_1[i].second) ;
    }
     j=type_1.size()-1 ;
    for(int i=0;i<y;i++)
    {
        if(j<=i)
            break ;
        auto it=m.find(type_1[i].second) ;
        m.erase(it) ;
        int flag=0 ;
        while(j>i)
        {
            if(type_1[j].first+type_1[i].first<=d)
            {
                flag=1 ;
                break ;
            }
            auto it=m.find(type_1[j].second) ;
            m.erase(it) ;
            j-- ;
        }
        if(flag==0)
            break ;
        if(m.size())
        ans=max(ans,type_1[i].second+*m.rbegin()) ;
    }
    cout<<ans<<"\n" ;
    return 0;
}

Uber โœ…
โค1
Hiringalert !
Job openings for Administration Executive profile,

MBA Fresher with specialisation in Finance and Marketing

Location -Greater Noida (WFO)

Skills- Tally, Advance Excel etc.

Interested candidates can share cv on career@pharmazz.com
๐Ÿ‘1
Genpact is seeking MBA freshers for the role of Recruitment Consultant in Noida.

This is a wonderful opportunity for those who want to start their career in the field of recruitment.
The role requires working from the office for 5 days a week.

If you're interested, kindly send your updated resume to faaiza.fatima@genpact.com or drop a comment/message.

We look forward to hearing from you!
๐Ÿ‘1