๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
int solution(vector<int>arr){
    int ans=INT_MIN;
    int result=-1;
    vector<int>weight(arr.size(),0);
    for(int i=0;i<arr.size();i++){
        int source=i;
        int dest=arr[i];
        if(dest!=-1){
            weight[dest]+=source;
            if(ans<=weight[dest]){
                ans=max(ans,weight[dest]);
                result=dest;
            }
           
        }
    }
    if(ans!=INT_MIN)
        return result;
    return -1;
}

Maximum Weight Node โœ…
Requires -

Graduate & Diploma Engineer Trainee

Bharat FIH

Job Description :

He/She will be deployed in the department based on their interest and suitability.
He/She will work along with the team members and perform their tasks, which is assigned by his/her superior.
He or She should perform well for their position to confirm after successfully completed their training period.
He or She has to participate in the department meeting and present their project or task when is required.
He/She has to deliver their tasks on time.

Education & Skills :

Diploma Engineer Trainee (DET)

Diploma Graduates (EEE/ECE/Mech/Mechatronics/Robotics) who have passed out 2022 / 2023
Good Academic Records
No Standing Arrears

Skill Set :

Good Communication skills (Verbal & Written)
Eager to learn
Pleasing Personality
Good in System Knowledge (MS Office)

Graduate Engineer Trainee (GET) :

BE/B.Tech Graduates (EEE/ECE/Mech/Mechatronics/Robotics) who have passed out 2022 / 2023
Good Academic Records
No Standing Arrears

Skill Set :

Good Communication skills (Verbal & Written)
Eager to learn
Pleasing Personality
Good in System Knowledge (MS Office)

Note : Immediate Joiners will be preferred

Working Place: Sunguvarchatram Plant

You can share your application to careers@fih-foxconn.com (Subject Line : Applied for the position of GET or DET Batch 2022/2023)
๐Ÿ‘2
FresherOpporunityAlert

Vembu Technologies is hiring Freshers ๐Ÿ‘จโ€๐Ÿ’ผ

๐Ÿ™‹๐Ÿปโ€โ™€๏ธProduct Success Engineer and QA Engineer Trainee

๐ŸŽ“B.E/B.Tech- CS/IT -2023 & 2024 batch passed out students

๐Ÿ™ŒNote: Minimum 70 % academic record required to attend the interview ( SSLC, HSC, UG) No standing Arears

๐ŸงณSalary-3.00 to 3.6 Lakhs/ CTC

๐Ÿ‘จโ€๐Ÿ’ผInterview and selection process :-

Written Test (Aptitude, English and Technical)
Face 2 Face Interview

๐Ÿ“ง Interested Candidates can email their resume with prabu@vembu.com
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream> 
#include <vector>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <unordered_set>
using namespace std;

vector<string> fep(unordered_map<string, vector<string>>& g, string s) {
    vector<string> st = {s};
    deque<string> p;
    while (!st.empty()) {
        string u = st.back();
        if (!g[u].empty()) {
            string v = g[u].front();
            g[u].erase(g[u].begin());
            st.push_back(v);
        } else {
            p.push_front(st.back());
            st.pop_back();
        }
    }
    return vector<string>(p.begin(), p.end());
}

int main() {
    int n, m;
    cin >> n >> m;
    unordered_map<string, vector<string>> g;
    unordered_set<string> ads;
    for (int i = 0; i < n; i++) {
        string a, b;
        cin >> a >> b;
        g[a].push_back(b);
        ads.insert(a);
        ads.insert(b);
    }
    for (auto it = g.begin(); it != g.end(); ++it) {
        sort(it->second.begin(), it->second.end());
    }
    string s = "ABC";
    vector<string> p = fep(g, s);
    for (const auto& x : p) {
        cout << x << " ";
    }
    cout << endl;
    return 0;
}


Flipkart โœ…
using namespace std;

vector<int> rc;
vector<vector<int>> adj;
vector<int> seq;

void dfs(int node) {
    if(adj[node].size() > 0) dfs(adj[node][0]);
    seq.push_back(rc[node]);
    if(adj[node].size() > 1) dfs(adj[node][1]);
}

int main() {
    int rCount;
    cin >> rCount;
    rc.resize(rCount);
    for(int i=0; i<rCount; i++) cin >> rc[i];
    int cRow, cCol;
    cin >> cRow >> cCol;
    adj.resize(rCount);
    for(int i=0; i<cRow; i++) {
        int u, v;
        cin >> u >> v;
        adj[u].push_back(v);
    }
    int rM;
    cin >> rM;
    dfs(0);
    cout << seq[rM-1] << endl;
    return 0;
}

Restaurant โœ…
Flipkart
using namespace std;

void pop_front(vector<int> &v) {
    if (v.size() > 0) {
        v.erase(v.begin());
    }
}

vector<int> helper(vector<int> nums, int c_len) {
    vector<int> ans;
    int In = nums.size();
    for(int i = 0; i < In; i++) {
        while(ans.size() > 0 && ans.back() < nums[i] && ((In - i) > (c_len - ans.size()))) {
            ans.pop_back();
        }
        if(ans.size() < c_len) {
            ans.push_back(nums[i]);
        }
    }
    return ans;
}

vector<int> solve(vector<int> nums1, vector<int> nums2, int k) {
    int l1 = nums1.size();
    int l2 = nums2.size();
    vector<int> rs;
    for (int s1 = max(0, k - l2); s1 <= min(k, l1); s1++) {
        vector<int> p1, p2;
        p1 = helper(nums1, s1);
        p2 = helper(nums2, k - s1);
        vector<int> temp;
        for (int j = 0; j < k; j++) {
            vector<int> temp2 = max(p1, p2);
            int fr = temp2.front();
            if (p1 > p2) {
                pop_front(p1);
            } else {
                pop_front(p2);
            }
            temp.push_back(fr);
        }
        rs = max(rs, temp);
    }
    return rs;
}

int main() {
    int n;
    cin >> n;
    vector<int> arr1(n);
    for(int i = 0; i < n; i++) {
        cin >> arr1[i];
    }
    int m;
    cin >> m;
    vector<int> arr2(m);
    for(int i = 0; i < m; i++) {
        cin >> arr2[i];
    }
    int k;
    cin >> k;
    vector<int> v = solve(arr1, arr2, k);
    for(int i = 0; i < v.size(); i++) {
        cout << v[i] << " ";
    }
    return 0;
}

University
Flipkart โœ…
int minimumChunksRequired(long long totalPackets,vector<vector<long long>>uploadedChunks){
    long long ans=0;
    long long prev=0;

    sort(uploadedChunks.begin(),uploadedChunks.end());

    for(int i=0;i<uploadedChunks.size();i++){
        if(uploadedChunks[i][0]==prev+1){
            prev=uploadedChunks[i][1];
            continue;
        }
        else{

            long diff=uploadedChunks[i][0]-prev-1;


            for(int k=0;k<64;k++){
                if(diff&(1LL<<k)){
                    ans++;
                }
            }

            prev=uploadedChunks[i][1];
        }
    }

    long diff=totalPackets-prev;

    for(int k=0;k<64;k++){
        if(diff&(1LL<<k)){
            ans++;
        }
    }

    return ans;

}
โค1
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cctype>

using namespace std;

string encodeString(const string &s) {
    stringstream ss(s);
    string word;
    vector<string> words;

    while (ss >> word) {
        reverse(word.begin(), word.end());
        words.push_back(word);
    }

    string reversedSentence;
    for (const auto &w : words) {
        reversedSentence += w + " ";
    }
    reversedSentence = reversedSentence.substr(0, reversedSentence.size() - 1);

    string encodedChars;
    for (size_t i = 0; i < reversedSentence.size(); ++i) {
        char c = reversedSentence[i];
        if (i % 2 == 0) {
            encodedChars += toupper(c);
        } else {
            encodedChars += tolower(c);
        }
    }

    for (size_t i = 0; i < encodedChars.size(); ++i) {
        if (encodedChars[i] == ' ') {
            encodedChars[i] = (i % 2 == 0) ? '#' : '*';
        } else if (encodedChars[i] == ',') {
            encodedChars[i] = '@';
        } else if (encodedChars[i] == '.') {
            encodedChars[i] = '@';
        } else if (encodedChars[i] == '-') {
            encodedChars[i] = ':';
        }
    }

    return encodedChars;
}

int main() {
    string inputString = "The mangy, scrawny stray dog hurriedly gobbled down the grain-free, organic dog food.";
    string outputString = encodeString(inputString);
    cout << outputString << endl;
    return 0;
}



// Mini orange 1st โœ…
โค1
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
string shortestPalindrome(string s)
    {
        reverse(s.begin(), s.end());
        string rev = s;
        reverse(s.begin(), s.end());
        string temp = s + "@" + rev;
        vector<int> vr = fail_fun(temp);

        int maxm = vr[vr.size()-1];

        temp = "";
        for(int i = maxm; i < s.length(); i++)
        {
            temp = temp + s[i];
        }       
        reverse(temp.begin(), temp.end());
        return temp + s;
    }

    vector<int> fail_fun(string &s)
    {
        int n = s.length();
        vector<int> fail_ar(n, 0);

        for(int i = 1, k = 0; i < n; i++)
        {
            while(k > 0 && s[k] != s[i])
            {
                k = fail_ar[k-1];
            }

            if(s[k] == s[i])
            {
                fail_ar[i] = ++k;
            }
        }

        return fail_ar;
    }

Miniorange
const int MOD = 1e9 + 7;
const int MAXN = 1e6;
using namespace std;
vector<bool> sieve() {
    vector<bool> isPrime(MAXN + 1, true);
    isPrime[0] = isPrime[1] = false;
    for (int i = 2; i <= sqrt(MAXN); ++i) {
        if (isPrime[i]) {
            for (int j = i * i; j <= MAXN; j += i) {
                isPrime[j] = false;
            }
        }
    }
    return isPrime;
}

int solve(const string& s) {
    int n = s.size();
    vector<bool> isPrime = sieve();
    vector<int> dp(n + 1, 0);
    dp[0] = 1;

    for (int i = 1; i <= n; ++i) {
        int num = 0;
        for (int j = 1; j <= 6 && i - j >= 0; ++j) {
            num = num + (s[i - j] - '0') * pow(10, j - 1);
            if (s[i - j] != '0' && num <= MAXN && isPrime[num]) {
                dp[i] = (dp[i] + dp[i - j]) % MOD;
            }
        }
    }

    return dp[n];
}

String estee โœ…
long getMaxCost(string s) {
    if (s.find('1') == string::npos) {
        return 0;
    }
    int ind = s.find('1');
    int count = 1;
    int n = s.length();
     long res = 0;
    int prev = ind;
   
    for (int i = ind + 1; i < n; ++i) {
        if (s[i] == '1') {
            if (prev != i - 1) {
                res += (i - prev) * count;
            }
            count += 1;
            prev = i;
        }
    }
   
    if (prev == n - 1) {
        prev = n;
    }
   
    return res + count * (n - prev);
}

Binary Circuit
Estee advisorโœ