๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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 <string>
#include <vector>
using namespace std;
vector<int> computeLPSArray(const string& str) {
    int n = str.length();
    vector<int> lps(n, 0);
        int len = 0;
    int i = 1;
    while (i < n) {
        if (str[i] == str[len]) {
            len++;
            lps[i] = len;
            i++;
        }
        else {
            if (len != 0) {
                len = lps[len - 1];
            }
            else {
                lps[i] = 0;
                i++;
            }
        }
    }
   
    return lps;
}
int solution(string& S) {
    int n = S.length();
    if (n <= 1) return 0;
        vector<int> lps = computeLPSArray(S);
    return lps[n-1] < n ? lps[n-1] : lps[lps[n-1]-1];
}


Task1
Amex โœ…
๐Ÿ‘2
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int solution(string &S) {
    int N = S.length();
    long long operations = 0;
        int start = 0;
    while (start < N && S[start] == '0') {
        start++;
    }
        if (start == N) return 0;
        for (int i = start; i < N; i++) {
        if (S[i] == '1') {
     
            operations += 2;
        } else {
            operations += 1;
        }
    }
    operations--;
   
    return operations;


Task2
Amexโœ…
int solution(vector<int> &A)
{
    int n = A.size();
    int res = 0;
    multiset<int>st;
    map<int, int>mp;
    for (int i = 0; i < n; i++)
    {
        mp[A[i]]++;
        st.insert(i);
        while (mp.size() > 2) {
            auto cur = *st.begin();
            st.erase(cur);
            mp[A[cur]]--;
            if (mp[A[cur]] == 0) {
                mp.erase(A[cur]);
            }

        }
        res = max(res, (int)(st.size()));
    }

    return res;
}

 

Task3
Amex โœ…
import heapq
def solve(a, b, c):
    d = [(x, x) for x in b]
    heapq.heapify(d)
    for _ in range(c):
        e, f = heapq.heappop(d)
        e += f
        heapq.heappush(d, (e, f))

    return max(e for e, _ in d)
t = int(input())
results = []
for _ in range(t):
    a = int(input())
    b = list(map(int, input().split()))
    c = int(input())
    results.append(solve(a, b, c))

for res in results:
    print(res)


Vehant Technology โœ…
#include <bits/stdc++.h>
using namespace std;

long getDataDependenceSum(long n) {
    set<long> dependentDays; 

    for (long k = 1; k * k <= n; ++k) {
        dependentDays.insert(n / k); 
        dependentDays.insert(k);     
    }

    long sum = 0;
    for (auto day : dependentDays) {
        sum += day;
    }
    return sum;
}

Amazon โœ…
#include <ibits/stdc++.h>
using namespace std;

int count(int num, int p) {
    int count = 0;
    while (num % p == 0 && num > 0) {
        count++;
        num /= p;
    }
    return count;
}

int solve(int n, vector<vector<int>>& v) {

    vector<vector<int>> dp2(n, vector<int>(n, INT_MAX));
    vector<vector<int>> dp5(n, vector<int>(n, INT_MAX));


    dp2[0][0] = count(v[0][0], 2);
    dp5[0][0] = count(v[0][0], 5);

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i > 0) {
                dp2[i][j] = min(dp2[i][j], dp2[i - 1][j] + count(v[i][j], 2));
                dp5[i][j] = min(dp5[i][j], dp5[i - 1][j] + count(v[i][j], 5));
            }
            if (j > 0) {
                dp2[i][j] = min(dp2[i][j], dp2[i][j - 1] + count(v[i][j], 2));
                dp5[i][j] = min(dp5[i][j], dp5[i][j - 1] + count(v[i][j], 5));
            }
        }
    }


    return min(dp2[n - 1][n - 1], dp5[n - 1][n - 1]);
}


Treasure Room โœ…
Netcore
๐Ÿ“ŒWe Urgently Need Manual Testers - (QA Engineers FRESHERS) at Ventures Digital India

Role: Associate Manual Tester [QA Engineer]
Qualification: Bachelor's Degree
Industry: IT/Software
Experience: 0-3 Year

Required Skills:
- Basic knowledge of Manual Testing
- Familiarity with Test Case Creation and Defect Management
- Basic knowledge of JIRA Tools

Note- Hybrid Mode [2 Days work from office]

Email- Neha.Toke@venturesdigitalindia.com
ACCENTURE Interview Experience

1) Self Intro ?
2) Project - Major & Minor ?
3) Difficulty Faced in Project?
4) Least subject u like. Why it is least?
5) Hobbies I said in Self Intro
    From Hobbies ( chess) he Asked y u
    like that,  do u play by Moves Names
    or Randomly Last but not the Least.
6) Do u have any Questions ?
string largestMagical(string binString) {
    if (binString.empty()) return binString;
    vector<string> ans;
    int cnt = 0, j = 0;
    for (int i = 0; i < binString.size(); ++i) {
        cnt += binString[i] == '1' ? 1 : -1;
        if (cnt == 0) {
            ans.push_back("1" + largestMagical(binString.substr(j + 1, i - j - 1)) + "0");
            j = i + 1;
        }
    }
    sort(ans.begin(), ans.end(), greater<string>());
    return accumulate(ans.begin(), ans.end(), string{});
}

Nvidia (intern) โœ…
#include <stdio.h>
#include <regex.h>
int isPowerOfTwo(const char *binaryString) {
    regex_t regex;
    int result;
    result = regcomp(&regex, "^0*10*$", REG_EXTENDED);
    if (result) {
        printf("Could not compile regex\n");
        return 0;
    }
    result = regexec(&regex, binaryString, 0, NULL, 0);
    regfree(&regex);
    if (!result) {
        return 1;
    } else {
        return 0;
    }
}

int main() {
    int t;
    char binaryString[1000];
    scanf("%d", &t);
    while (t--) {
        scanf("%s", binaryString);
        if (isPowerOfTwo(binaryString)) {
            printf("True\n");
        } else {
            printf("False\n");
        }
    }

    return 0;
}


Nvidia โœ…
๐Ÿ‘2
#include <iostream>
#include <vector>
#include <algorithm>

const int MOD = 1e9 + 7;

using namespace std;

long long solve(const vector<int>& a, int b) {
    int c = a.size();
    long long d = 0;
    for (int i = 0; i < c; i++) {
        d += a[i];
    }

    vector<long long> e(b + 1, 0);
    e[0] = 1;

    for (int i = 0; i < c; i++) {
        for (int j = b; j >= a[i]; j--) {
            e[j] = (e[j] + e[j - a[i]]) % MOD;
        }
    }
    long long f = 1;
    for (int i = 0; i < c; i++) {
        f = (f * 2) % MOD;
    }

    long long g = 0;
    for (int i = 0; i <= b; i++) {
        g = (g + e[i]) % MOD;
    }

    long long h = (f - 2 * g + MOD) % MOD;
    return h;
}


Sum of the elements โœ…
Oyo