๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.57K subscribers
5.58K photos
3 videos
95 files
10K 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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
bool isPrime(int num) {
    if (num <= 1) return true;
    if (num == 2) return true;
    if (num % 2 == 0) return false;
    for (int i = 3; i <= sqrt(num); i += 2) {
        if (num % i == 0) return false;
    }
    return true;
}
int nearestPrime(int num) {
    if (isPrime(num)) return num; 
    int lower = num - 1, higher = num + 1;

    while (lower > 1 || higher <= 1e5) { 
        if (lower > 1 && isPrime(lower)) return lower;
        if (isPrime(higher)) return higher;
        lower--;
        higher++;
    }
    return 2;
}

int main() {
    int N, M;
    cin >> N >> M;

    vector<vector<int>> matrix(N, vector<int>(M));

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            cin >> matrix[i][j];
        }
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            int currentElement = matrix[i][j];

            if (isPrime(currentElement)) {
                if (i - 1 >= 0) {
                    if (isPrime(matrix[i - 1][j])) {
                        matrix[i - 1][j] *= 2;
                    } else {
                        matrix[i - 1][j] = nearestPrime(matrix[i - 1][j]);
                    }
                }
                if (j + 1 < M) {
                    if (isPrime(matrix[i][j + 1])) {
                        matrix[i][j + 1] *= 2;
                    } else {
                        matrix[i][j + 1] = nearestPrime(matrix[i][j + 1]);
                    }
                }
                if (i + 1 < N) {
                    if (isPrime(matrix[i + 1][j])) {
                        matrix[i + 1][j] *= 2;
                    } else {
                        matrix[i + 1][j] = nearestPrime(matrix[i + 1][j]);
                    }
                }
                if (j - 1 >= 0) {
                    if (isPrime(matrix[i][j - 1])) {
                        matrix[i][j - 1] *= 2;
                    } else {
                        matrix[i][j - 1] = nearestPrime(matrix[i][j - 1]);
                    }
                }
            }
        }
    }

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            cout << matrix[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}


MasterCard (FTE) โœ…
#include <bits/stdc++.h>
using namespace std;

int main() {
    vector<int> c(8);
    for (int i = 0; i < 8; i++) {
        cin >> c[i];
    }

    int p;
    cin >> p;
    bool conflict[8][8];
    memset(conflict, false, sizeof(conflict));

    for (int i = 0; i < p; i++) {
        int a, b;
        cin >> a >> b;
        conflict[a-1][b-1] = true; 
        conflict[b-1][a-1] = true;
    }

    int maxMoney = 0;

    for (int mask = 0; mask < (1 << 8); mask++) {
        bool valid = true;
        int total = 0;


        for (int i = 0; i < 8 && valid; i++) {
            if (mask & (1 << i)) {
                total += c[i];
                for (int j = i + 1; j < 8; j++) {
                    if ((mask & (1 << j)) && conflict[i][j]) {
                        valid = false;
                        break;
                    }
                }
            }
        }

        if (valid) {
            maxMoney = max(maxMoney, total);
        }
    }

    cout << maxMoney << endl;

    return 0;
}


Atlanโœ…
#include <iostream>
#include <set>
#include <cmath>
using namespace std;
int ss(int N) {
    set<int> s;
    for (int p = 1; p * p <= N; ++p)
    {
    int r = p * p;
    for (int q = 1; q * q * q <= N; ++q)
    {
    int cube = q * q * q;
    int sum = r + cube;
    if (sum <= N)
    {
    s.insert(sum);
    }
    }
    }
    return s.size();
}
int main()
{
    int N;
    cin >> N;
    cout << ss(N) << endl;
    return 0;
}


Count Perfect Sums โœ…
Airtel
๐Ÿ‘1
Enjoy our content? Advertise on this channel and reach a highly engaged audience! ๐Ÿ‘‰๐Ÿป

It's easy with Telega.io. As the leading platform for native ads and integrations on Telegram, it provides user-friendly and efficient tools for quick and automated ad launches.

โšก๏ธ Place your ad here in three simple steps:

1 Sign up

2 Top up the balance in a convenient way

3 Create your advertising post

If your ad aligns with our content, weโ€™ll gladly publish it.

Start your promotion journey now!
๐Ÿ“ŒCompany Name: Orange mantra
Designation: Analyst

CTC: Up to 4 LPA
Qualification: Btech/MBA
Experience: Freshers or 6 months
Location: Gurgaon, Haryana

Employment type: Full Time
No of working days: 5

Skills Required
-Excellent Communication & Presentation skills
-Proficient in MS-office
-Data Analysis & reporting
-Research & Analytical skills.

*Note*: Immediate joiners preferred
Share your CV: chaudhary.pratima@orangemantra.in
long getMaxRequests(vector<int>& sc, vector<int>& ir, int k) {
    int n = sc.size();
    long total = 0;
    vector<int> extra(n, 0);

    for (int i = 0; i < n; i++) {
        int h = min(sc[i], ir[i]);
        total += h;

        if (sc[i] < ir[i]) {
            int dch = min(2 * sc[i], ir[i]);
            extra[i] = dch - h;
        }
    }

    sort(extra.rbegin(), extra.rend());

    for (int i = 0; i < k; i++) {
        total += extra[i];
    }

    return total;
}

Twillo โœ…
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
int getMaxOccurrences(string components, int minLength, int maxLength, int maxUnique) {
    const int mod = 1e9 + 7;
    map<long, int> freq;
    vector<int> count(26, 0);
    int l = 0;
    int ans = 0;
    int noOfLetter = 0;
    long hash_curr = 0;
    long pow = 1;
   
    for (int i = 0; i < minLength - 1; i++) {
        pow = (pow * 53) % mod;
    }
   
    for (int r = 0; r < components.size(); r++) {
        count[components[r] - 'a']++;
        if (count[components[r] - 'a'] == 1) {
            noOfLetter++;
        }
        if ((r - l + 1) > minLength) {
            hash_curr = ((hash_curr - (components[l] - 'a' + 1) * pow) % mod + mod) % mod;
            count[components[l] - 'a']--;
            if (count[components[l] - 'a'] == 0) {
                noOfLetter--;
            }
            l++;
        }
        hash_curr = ((hash_curr * 53) % mod + (components[r] - 'a' + 1)) % mod;
        if ((noOfLetter <= maxUnique) && (r - l + 1) >= minLength && (r - l + 1) <= maxLength) {
            ans = max(ans, ++freq[hash_curr]);
        }
    }
    return ans;
}

Twillo โœ…
๐Ÿ‘1
Hiring Alerts for 3-6 months of Winter Internship Program'24!

Data & Business Analyst Intern
3-6 months internship with potential of PPO
Open positions: HR, Finance, Marketing, EA, BDA, Growth, Product, Interior Design, Product, SDE, Sales Analyst, Finance, BD, Graphic Design, Strategy, Sales and Growth.
Remote/Hybrid Work.
Immediate Joiner.
Competitive Compensation.

PS:CTC Starting from โ‚น4.6 LPA, We will start interview process by 15th of Oct'24

College/Institutions are most welcome for internship fair.

Note: Just comment, Intrested or Drop your CV at career@minimalix.in and one of the our HR team will get in touch with you soon (TAT: 3 Working Days) and don't share your contact number in comment section. Minimalix