๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
9.55K subscribers
5.58K photos
3 videos
95 files
9.91K 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
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
if(s.size()==0){             cnt--;             continue;         } Just add this, number of candies Google Girl Hackathon
#include <bits/stdc++.h>
using namespace std;

const int mod = 1e9+7;

int maximum_candies(int n, int m, vector<vector<int>> gift) {
    vector<multiset<int>> v(n+1);
    for(int i=0; i<m; i++){
        int d = gift[i][0];
        int val = gift[i][1];
        v[d].insert(val);
    }
    int ans = 0;
    int cnt = n;
    multiset<int> s;
    for (int i=1; i<=n ; i++){
        for (auto j:v[i]){
            s.insert(j);
        }
        if(s.size()==0){
            cnt--;
            continue;
        }
        auto it=s.end();
        it--;
        int el=*it;
        ans=(ans%mod +((el%mod)*(cnt%mod))%mod)%mod;
        cnt--;
        s.erase(it);
    }
    return ans%mod;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<int>> gift(m, vector<int>(2));
    for(int i=0; i<m; i++){
        cin >> gift[i][0] >> gift[i][1];
    }
    cout << maximum_candies(n, m, gift) << endl;
    return 0;
}

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

int lcs(string A, string B ) {
    int m = A.size(), n = B.size();
    vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
    int maxLen = 0;
    for (int i = 1; i <= m; ++i) {
        for (int j = 1; j <= n; ++j) {
            if (A[i - 1] == B[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1] + 1;
                maxLen = max(maxLen, dp[i][j]);
            }
        }
    }
    return maxLen;
}

int solve(string A, string B ) {
    int len = lcs(A, B);
    return A.size() + B.size() - 2 * len;
}

int main() {
    string A, B;
    cin >> A >> B;
    cout << solve(A, B ) << endl;
    return 0;
}

Equal Stringsโœ…
Airbus
Zoomcar is hiring for Interns for Data Science and Data Engineering teams.

Duration: 6 Months (paid internship)

Preferred Colleges: Tier 1 & Tier 2

Location: Bangalore (WFO)

If youโ€™re an immediate joiner, please send your resume at soundarya.ds@zoomcar.com
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 โœ…
๐Ÿ‘1
๐ŸšจJOB OPENING ALERT๐Ÿšจ

Company โ€“ Cerina Health
Role โ€“ AI ML Engineer - Intern
Exp. โ€“ Fresher
Apply Here โ€“ https://www.linkedin.com/jobs/view/3902420120

Company โ€“ NextGen Technologies
Role โ€“ Data Scientist
Exp. โ€“ Fresher
Apply Here โ€“ https://www.linkedin.com/jobs/view/3903571754

Company โ€“ Express Analytics India Pvt Ltd
Role โ€“ Data Science Internship
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/details/work-from-home-data-science-internship-at-express-analytics-india-pvt-ltd1713511795?utm_source=cp_link&referral=web_share

Company โ€“ DEPLOYH.AI Technologies
Role โ€“ Data Engineer Intern
Exp. โ€“ 0-1 yr
Apply Here โ€“ https://www.naukri.com/job-listings-data-engineer-intern-deployh-ai-technologies-private-limited-hyderabad-0-to-1-years-160424012587?src=jobsearchDesk&sid=17135123840742782_3&xp=1&px=1&nignbevent_src=jobsearchDeskGNB
๐Ÿ‘2
#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<vector<ll>>adj[10000006];
ll solve(ll n)
{
    vector<ll>vis(n,0);
    priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>pq;
    vector<ll>dist(n,1e9);
    dist[0]=0;
    pq.push({0,0});
    vis[0]=1;
    while(!pq.empty()){
        ll dis=pq.top().first;
        ll node=pq.top().second;
        vis[node]=1;
        pq.pop();
        for(auto it:adj[node]){
            ll edw=it[1];
            ll adjNode=it[0];
            if(dis+edw<dist[adjNode]){
                dist[adjNode]=dis+edw;
                pq.push({dist[adjNode],adjNode});
            }
        }
    }
    ll res=dist[0];
    for(ll i=0;i<n;i++)
    {
        res=max(res,dist[i]);
        if(!vis[i])return -1;
    }
    return res;
}
signed main()
{
    ll n,m; cin>>n>>m;
    for(ll i=0;i<m;i++)
    {
       ll a,b,c; cin>>a>>b>>c;
       a--;
       b--;
       adj[a].push_back({b,c});
    }
    cout<<solve(n);
    return 0;
}


Network delay Time โœ…
#include <iostream>
#include <vector>
#include <stack>

using namespace std;

vector<int>solve(vector<int>& arr) {
    vector<int>result;
    stack<int>s;
    for (int i=0;i<arr.size();i++)
    {
        while (!s.empty() && s.top() >= arr[i]) s.pop();
        if (s.empty()) result.push_back(-1);
        else result.push_back(s.top());
        s.push(arr[i]);
    }
    return result;
}

int main() {
    int n; cin>>n;
    vector<int>arr(n);
    for(int i=0;i<n;i++) cin>>arr[i];
    vector<int>result=solve(arr);
    for (auto it:result) cout<<it<<" ";
    return 0;
}


Height Problem โœ