๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <iostream>
#include <vector>
using namespace std;

int countWays(int n, int k) {
    vector<vector<int>> dp(n + 1, vector<int>(k + 1, 0));
    vector<vector<int>> cumSum(n + 1, vector<int>(k + 1, 0));

    for (int i = 1; i <= k; ++i) {
        dp[1][i] = 1;
        cumSum[1][i] = cumSum[1][i - 1] + dp[1][i];
    }

    for (int len = 2; len <= n; ++len) {
        for (int j = 1; j <= k; ++j) {
            dp[len][j] = cumSum[len - 1][j / 2];
            cumSum[len][j] = cumSum[len][j - 1] + dp[len][j];
        }
    }

    return cumSum[n][k];
}

Commvault โœ…
Good for 1st and 2nd yr students

If you want to start Open Source Contribution, Here are 5 beginner friendly repos where you can start by solving issues:

- CodeTriage: A tool to help developers find open issues in GitHub repositories that need attention.
https://lnkd.in/gdxsNnds

- Tirith: A policy framework that scans declarative Infrastructure as Code (IaC) configurations.
https://lnkd.in/g9RW6pE5

- RealWorld: It is a full-stack example app that demonstrates various frameworks and libraries by building the same application, a medium clone.
https://lnkd.in/gxz6sXfS

- PublicLab: It is a community where people can come together to explore environmental concerns using DIY techniques.
https://lnkd.in/gNzvXN5N

- Oppia: It is an online learning platform that enables users to create and share interactive educational activities.
https://lnkd.in/gDgZds_n
TalentCorp Hiring Graduate Trainee โค๏ธโค๏ธโค๏ธ

Qualifications: BAMS, Any Graduate, B.Arch , B.Tech/B.E. , BCA , B.B.A/ B.M.S , ITI Certification , B.Sc in , B.Com , B.El.Ed , B.Ed , B.Des. , Diploma , B.A.

Experience: 0 โ€“ 3 years

Job Type: Full Time

Location:  Pune

Skills/Requirements:
1. Ability to quickly learn and adjust to new tasks and environments.
2. Strong verbal and written communication to effectively interact with colleagues and supervisors.
3. Ability to assess information, solve problems, and make data-driven decisions.
4. Working collaboratively with others, contributing to team goals, and supporting peers.

Date of Interview: 10th August, 2024

Time : 8.30 AM โ€“ 12.30 PM

Venue: TalentCorp Solutions Pvt Ltd Ground Floor, Soham Complex, Opposite Gajanan Hospital, Ranjangaon (Pune).
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000000;
const int SEG_TREE_SIZE = 2097152;
vector<pair<int, int>> upd[MAXN + 10];
long long rao[SEG_TREE_SIZE];
long long sum[SEG_TREE_SIZE];
void update(int t, int l, int r, int x, int y) {
    if (x < l || r < x) return;
    rao[t] += y;
    sum[t] += 1LL * x * y;
    if (l == r) return;
    update(2 * t, l, (l + r) / 2, x, y);
    update(2 * t + 1, (l + r) / 2 + 1, r, x, y);
}
void get(int t, int l, int r, long long k, long long &B) {
    if (rao[t] <= k) {
        B += sum[t];
        return;
    }
    if (k <= 0) return;
    if (l == r) {
        B += 1LL * k * l;
        return;
    }
    get(2 * t, l, (l + r) / 2, k, B);
    get(2 * t + 1, (l + r) / 2 + 1, r, k - rao[2 * t], B);
}
long getMinCost(int n, int k, vector<vector<int>> plans) {
    memset(rao, 0, sizeof(rao));
    memset(sum, 0, sizeof(sum));

    long long res = 0;

    for (const auto& plan : plans) {
        int l = plan[0];
        int r = plan[1];
        int c = plan[2];
        int p = plan[3];
        upd[l].push_back({c, p});
        upd[r + 1].push_back({-c, p});
    }

    for (int i = 1; i <= n; ++i) {
        for (const auto& operation : upd[i]) {
            update(1, 1, MAXN, operation.second, operation.first);
        }
        long long B = 0;
        get(1, 1, MAXN, min(1LL * k, rao[1]), B);
        res += B;
    }

    return res;
}


CLOUD DATA TRANSFERโœ…
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll solve(vector<ll>&a,vector<ll>&b,ll n,ll m)
{
    ll ans=0;
    ll s1=0,s2=0;
    ll i=0,j=0;
    while(i<n and j<m)
    {
        if(a[i]<b[j]) s1+=a[i++];
        else if(a[i]>b[j]) s2+=b[j++];
        else
        {
            ans+=max(s1,s2)+a[i];
            i++;
            j++;
            s1=0;
            s2=0;
        }
    }
    while(i<n) s1+=a[i++];
    while(j<m) s2+=b[j++];
    return max(s1,s2)+ans;
}
signed main()
{
    ll n; cin>>n;
    vector<ll>a(n);
    for(ll i=0;i<n;i++) cin>>a[i];
    ll m; cin>>m;
    vector<ll>b(m);
    for(ll i=0;i<n;i++) cin>>b[i];
    cout<<solve(a,b,n,m);
}

Cave coin collection โœ…
Intuit
#include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;

int main() {
    int k; 
    cin >> k;
    int n; 
    cin >> n;
    vector<int> arr(n);
    for (int i = 0; i < n; i++) cin >> arr[i];
   
    sort(arr.begin(), arr.end());
   
    int min_diff = 1e9;
    int best_sum = -1;
   
    for (int i = 0; i < n; i++) {
        int first = arr[i];
       
        int lb = lower_bound(arr.begin() + i + 1, arr.end(), first + k) - arr.begin();
       
        for (int j = lb - 1; j <= lb; j++) {
            if (j > i && j < n) {
                int second = arr[j];
                int diff = abs(k - (second - first));
                int sum = first + second;
               
                if (diff < min_diff || (diff == min_diff && sum > best_sum)) {
                    min_diff = diff;
                    best_sum = sum;
                }
            }
        }
    }
   
    cout << best_sum << endl;
    return 0;
}

The Chemist
Uber โœ…
๐Ÿ”ฅ1
#include <bits/stdc++.h>>
using namespace std;

const int MOD = 10000;

int countArrays(string &S, int C, int K) {
    int N = S.length();
    vector<int> dp(N + 1, 0);
    dp[0] = 1; 

    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= K && j <= i; j++) {
            string num_str = S.substr(i - j, j);
            long long num = stoll(num_str);

            if (num <= C) {
                dp[i] = (dp[i] + dp[i - j]) % MOD;
            }
        }
    }

    return dp[N];
}

int main() {
    int N, C, K;
    cin >> N >> C >> K;

    string S;
    cin >> S;

    cout << countArrays(S, C, K) << endl;

    return 0;
}


Without whitespaces
Uber โœ…
๐Ÿ”ฅ1๐Ÿ˜1
#include <bits/stdc++.h>
using namespace std;

bool chkValid(const vector<string>& eq, unordered_map<char, int>& l2d) {
    vector<long long> nums;
    for (const string& p : eq) {
        long long num = 0;
        for (char c : p) {
            num = num * 10 + l2d[c];
        }
        nums.push_back(num);
    }
    return nums[0] + nums[1] == nums[2];
}

int dfs(vector<string>& eq, unordered_map<char, int>& l2d, unordered_set<int>& tD, vector<char>& let, int pos) {
    if (pos == let.size()) {
        return chkValid(eq, l2d) ? 1 : 0;
    }
   
    char l = let[pos];
    int count = 0;
    for (int d = 0; d < 10; ++d) {
        if (tD.count(d)) continue;
        if (d == 0 && find_if(eq.begin(), eq.end(), [&](string& p) { return p[0] == l; }) != eq.end()) continue;
       
        tD.insert(d);
        l2d[l] = d;
       
        count += dfs(eq, l2d, tD, let, pos + 1);
       
        tD.erase(d);
        l2d.erase(l);
    }
   
    return count;
}

int cntCryptarithmSolutions(vector<string> eq) {
    unordered_set<char> allLet;
    for (const string& p : eq) {
        for (char c : p) {
            allLet.insert(c);
        }
    }
   
    vector<char> let(allLet.begin(), allLet.end());
    unordered_map<char, int> l2d;
    unordered_set<int> tD;
   
    return dfs(eq, l2d, tD, let, 0);
}


Crypt
Trilogy โœ…
bool placeBlock(vector<vector<char>>& field, int row, int& finalRow, int& finalCol) {
    int col = 0;
    while (col < field[0].size() && field[row][col] == '.') ++col;

    while (row < field.size() - 1 && field[row + 1][col] == '.') ++row;

    if (col >= 0 && row >= 0) {
        field[row][col] = '#';
        finalRow = row;
        finalCol = col;
        return true;
    }
    return false;
}

void removeBlock(vector<vector<char>>& field, int row, int col) {
    field[row][col] = '.';
}

void solve(vector<vector<char>>& field, vector<int>& ans, int cnt) {
    bool check = true;
    for (int i = 0; i < field.size(); ++i) {
        if (field[i][0] != '#') {
            check = false;
            break;
        }
    }
    if (check) {
        ans[0] = min(ans[0], cnt);
        ans[1] = max(ans[1], cnt);
        return;
    }

    for (int i = 0; i < field.size(); ++i) {
        int finalRow = -1, finalCol = -1;

        if (placeBlock(field, i, finalRow, finalCol)) {
            solve(field, ans, cnt + 1);

            removeBlock(field, finalRow, finalCol);
        }
    }
}

vector<int> solution(vector<vector<char>> field) {
    vector<int> ans = {INT_MAX, INT_MIN};
    solve(field, ans, 0);
    return ans;
}

Block placing
Trilogy โœ…
๐Ÿ‘Ž2
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Maze Craze โœ…
#include <iostream>
#include <vector>

using namespace std;

const int MOD = 1e9 + 7;

int solve(int N, int M, vector<vector<int>>& nums) {

    vector<vector<long long>> dp(N, vector<long long>(M, 0));
    dp[0][0] = nums[0][0];
   

    for (int j = 1; j < M; ++j) {
        dp[0][j] = (dp[0][j - 1] * nums[0][j]) % MOD;
    }
   
    for (int i = 1; i < N; ++i) {
        dp[i][0] = (dp[i - 1][0] * nums[i][0]) % MOD;
    }
   

    for (int i = 1; i < N; ++i) {
        for (int j = 1; j < M; ++j) {
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) * nums[i][j] % MOD;
        }
    }
   
    return dp[N - 1][M - 1];
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<vector<int>> nums(N, vector<int>(M));
   
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < M; ++j) {
            cin >> nums[i][j];
        }
    }
   
    cout << solve(N, M, nums) << endl;
   
    return 0;
}


Maze Crazeโœ…
๐Ÿ‘1