๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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 <iostream>
#include <vector>
#include <unordered_map>
#include <cmath>
#include <algorithm>
using namespace std;
class UnionFind {
public:
    UnionFind(int n) : parent(n), size(n, 1) {
        for (int i = 0; i < n; ++i) {
            parent[i] = i;
        }
    }
    int find(int x) {
        if (x != parent[x]) {
            parent[x] = find(parent[x]);
        }
        return parent[x];
    }
    void unionSet(int x, int y) {
        int rootX = find(x);
        int rootY = find(y);
        if (rootX != rootY) {
            if (size[rootX] < size[rootY]) {
                swap(rootX, rootY);
            }
            parent[rootY] = rootX;
            size[rootX] += size[rootY];
        }
    }
    int getSize(int x) {
        return size[find(x)];
    }
private:
    vector<int> parent;
    vector<int> size;
};
vector<int> primeFactors(int x) {
    vector<int> factors;
    for (int i = 2; i <= sqrt(x); ++i) {
        if (x % i == 0) {
            factors.push_back(i);
            while (x % i == 0) {
                x /= i;
            }
        }
    }
    if (x > 1) {
        factors.push_back(x);
    }
    return factors;
}
int largestMagicalGroup(int N, vector<int>& A) {
    UnionFind uf(*max_element(A.begin(), A.end()) + 1);
    unordered_map<int, int> value_to_index;
    for (int i = 0; i < N; ++i) {
        value_to_index[A[i]] = i;
        for (int prime : primeFactors(A[i])) {
            uf.unionSet(A[i], prime);
        }
    }
    unordered_map<int, int> group_sizes;
    int max_group_size = 1;
    for (int i = 0; i < N; ++i) {
        int root = uf.find(A[i]);
        group_sizes[root]++;
        max_group_size = max(max_group_size, group_sizes[root]);
    }
    return max_group_size;
}

Magical Group โœ…
๐Ÿ‘3
#include <iostream>
#include <vector>
using namespace std;
int solution(vector<string> &A) {
    int RR = 0, GG = 0, RG = 0, GR = 0;
    for (string &s : A) {
        if (s == "RR") RR++;
        else if (s == "GG") GG++;
        else if (s == "RG") RG++;
        else GR++;
    }
   
    if (RG || GR)
        return RR + GG + 2 * min(RG, GR) + (RG != GR);
    else
        return max(RR, GG);
}

Microsoft โœ…
โค1
#include <iostream>
#include <vector>
#include <unordered_set>

Vector<int> getGoodElements(vector<int>a){
    unordered_set<int> set;
    vector<int>ans;
   
   
    for (int it : a) {
        unordered_set<int> tmp(set);
        for (int itt : set) {
            if (itt < it) {
                tmp.insert(it | itt);
            }
        }
        set = tmp;
        set.insert(it);
    }
    ans.push_back(0);
    for(int i:set) ans.push_back(i);
    return ans;
   
   
    return 0;
}

Citadel โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <queue>

using namespace std;

class T {
public:
    int x;
    T* l;
    T* r;

    T(int x_, T* l_ = nullptr, T* r_ = nullptr) : x(x_), l(l_), r(r_) {}
    T() : x(0), l(nullptr), r(nullptr) {}
};


T* extendT(T* node) {
    if (!node) return node;

    if (!node->l && !node->r) {
        node->l = new T(node->x,nullptr,nullptr);
        node->r = new T(node->x,nullptr,nullptr);
    } else {
        extendT(node->l);
        extendT(node->r);
    }
    return node;
}

void printLevelOrder(T* root) {
    if (!root) return;
   
    queue<T*> q;
    q.push(root);
   
    while (!q.empty()) {
        T* node = q.front();
        q.pop();
       
        cout << node->x << " ";
       
        if (node->l) q.push(node->l);
        if (node->r) q.push(node->r);
    }
    cout << endl;
}

int main() {
    // Creating the specified binary T
    T* root = new T(1);
    root->l = new T(2);
    root->r = new T(3);
    root->l->l = new T(4);
    root->l->r = new T(5);
    root->r->l = new T(6);

    cout << "Original T (Level-order traversal): ";
    printLevelOrder(root);
    root = extendT(root);
    cout << "Extended T (Level-order traversal): ";
    printLevelOrder(root);

    return 0;
}
๐ŸšจLatest Job Opening Update๐Ÿšจ

Company โ€“ Lumosys
Role โ€“ Data Analyst
Exp. โ€“ Fresher
Apply Here โ€“ https://www.linkedin.com/jobs/view/3970590490

Company โ€“ Cushman & Wakefield
Role โ€“ Data Analyst
Exp. โ€“ Fresher
Apply Here โ€“ https://careers.cushmanwakefield.com/global/en/job/CUWAGLOBALR240308ENAPACEXTERNAL/Data-Analyst-Generalist?utm_source=linkedin&utm_medium=phenom-feeds

Company โ€“ Maxgen Technologies Private Limited
Role โ€“ DATA ANALYST INTERNSHIP
Exp. โ€“ Fresher
Apply Here โ€“ https://www.foundit.in/job/data-analyst-internship-at-pune-maxgen-technologies-private-limited-pune-aurangabad-31080862?searchId=024c17c0-43d0-4685-aa32-f7eff911576c

Company โ€“ Soul Ai
Role โ€“ Data Scientist
Exp. โ€“ Fresher
Apply Here โ€“ https://www.naukri.com/job-listings-data-scientist-soul-ai-hyderabad-0-to-0-years-080724010188?src=sortby&sid=17205139582078710_1&xp=6&px=1

Company โ€“ Soul Ai
Role โ€“ Data Engineer
Exp. โ€“ Fresher
Apply Here โ€“ https://www.naukri.com/job-listings-data-engineer-soul-ai-hyderabad-0-to-0-years-080724010135?src=sortby&sid=17205139582078710_1&xp=7&px=1

Company โ€“ PartnerFirms
Role โ€“ Data Engineer
Exp. โ€“ Fresher
Apply Here โ€“ https://www.linkedin.com/jobs/view/3967437296

Company โ€“ Citi
Role โ€“ Business Analytics Analyst
Exp. โ€“ 0-2 yrs
Apply Here โ€“ https://www.simplyhired.co.in/job/P_uzl7zlJZgSJBvCxnABn-Z6LhIh6x_tf2dyo9YFRarLi1y0nTBg

Company โ€“ Resolute AI Software Private Limited
Role โ€“ AI Engineer Intern
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/details/work-from-home-ai-engineer-internship-at-resolute-ai-software-private-limited1720498515?utm_source=cp_link&referral=web_share
ll solve(vector<int>& heights) {
    int n = heights.size();
    vector<ll> left(n), right(n, n);
    stack<int> s;
    for (int i = 0; i < n; ++i) {
        while (!s.empty() && heights[s.top()] <= heights[i]) {
            right[s.top()] = i;
            s.pop();
        }
        left[i] = s.empty() ? -1 : s.top();
        s.push(i);
    }
    ll tot = 0;
    for (int i = 0; i < n; ++i) {
        tot += (i - left[i]) + (right[i] - i) - 1;
    }
    return tot;
}.

// CALCULATE REGION
MSCI โœ…
๐Ÿ‘1
#include <iostream>
#include <vector>
using namespace std;
const int MOD = 10000000;
int solve(int N, const string& a) {
    vector<vector<int>> dp(N, vector<int>(3, 0));
    if (a[0] != 'R') dp[0][0] = 1;
    if (a[0] != 'P') dp[0][1] = 1;
    if (a[0] != 'S') dp[0][2] = 1;
    for (int i = 1; i < N; ++i) {
        if (a[i] != 'R') {
            dp[i][0] = (dp[i-1][1] + dp[i-1][2]) % MOD;
        }
        if (a[i] != 'P') {
            dp[i][1] = (dp[i-1][0] + dp[i-1][2]) % MOD;
        }
        if (a[i] != 'S') {
            dp[i][2] = (dp[i-1][0] + dp[i-1][1]) % MOD;
        }
    }
    int ans = (dp[N-1][0] + dp[N-1][1] + dp[N-1][2]) % MOD;
    return ans;
}.

RocK paper scissors โœ…
โค1