๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.52K subscribers
5.55K photos
3 videos
95 files
9.64K 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
Wishing all students a joyful and prosperous Diwali! As you prepare for your upcoming challenges, may the festival of lights inspire you with renewed energy and determination. Embrace the spirit of the season and let it illuminate your path to success. Remember, hard work and perseverance will guide you through any obstacles. Stay focused, believe in your abilities, and celebrate each step of your journey. You've got this!
int findmaximumPackages(vector<int>&arr)
{
    int n = arr.size();
    int mx = *max_element(arr.begin(), arr.end());
    mx = mx * 2;
    int res = 0;
    map<int, int>mp;
    for (auto it : arr) {
        mp[it]++;
    }
    for (int i = 1; i <= mx; i++) {
        int sm = 0;
        for (int j = 1; j <= (i - 1) / 2; j++) {
            sm += min(mp[j], mp[i - j]);
        }
        if (i % 2 == 0) {
            sm += (mp[i / 2] / 2);
        }
        res = max(res, mp[i] + sm);
    }
    return res;
}

Amazon โœ…
#include <bits/stdc++.h>
using namespace std;
unordered_map<string, long> g(vector<string>& w) {
    unordered_map<string, long> m;
    for (const string& x : w) {
        string y = x;
        sort(y.begin(), y.end());
        m[y]++;
    }
    return m;
}
vector<long> substitutions(vector<string>& w, vector<string>& p) {
    unordered_map<string, long> m = g(w);
    vector<long> r;
    for (const string& q : p) {
        stringstream ss(q);
        string z;
        long c = 1;
        while (ss >> z) {
            string t = z;
            sort(t.begin(), t.end());
            c *= m[t];
        }
        r.push_back(c);
    }
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll> msk(1024,-1);
void digits(ll num1) {
    string str1 = to_string(num1);
    set<ll>s;
    for (char digit : str1) {
        ll d=digit-'0';
        s.insert(d);
    }
    ll val=0;
    for(auto it:s) val+=(1<<it);
    msk[val]=max(msk[val],num1);
}

ll solution(vector<ll>& A) {
    for(auto &it:msk) it=-1;
    ll ans=-1;
    for(auto it:A) digits(it);
    for(ll i=1;i<1024;i++){
        if(msk[i]==-1) continue;
        for(ll j=i+1;j<1024;j++){
            if(msk[j]==-1) continue;
            ll fl=0;
            for(ll k=0;k<10;k++){
                if((1<<k)&i){
                    if((1<<k)&j){
                        fl=1;
                        continue;
                    }
                }
            }
            if(fl) continue;
            ans=max(ans,msk[i]+msk[j]);
        }
    }
    return ans;
}


Microsoft โœ…
def arrayMaxima(n,a):
    evens, odds = [], []
    for x in a:
        if x % 2 == 0:
            evens.append(x)
        else:
            odds.append(x)
   
    x = max(evens) - min(evens)
    y = max(odds) - min(odds)
   
    return x + y


EY โœ…
def minimizeeffort(e):
    n = len(e)
    e.sort()
    m = {}
    s = 0
    for i in range(n):
        c = e[i]
        min_effort = c
        for d in range(1, int(c**0.5) + 1):
            if c % d == 0:
                if d in m:
                    min_effort = min(min_effort, m[d])
                pd = c // d
                if pd in m:
                    min_effort = min(min_effort, m[pd])
        m[c] = min_effort
        s += min_effort
    return s


Amazon โœ