๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
def minimumSquads(parents):
    n = len(parents)
    depth = [-1] * n

    def calculate_depth(node):
        if depth[node] != -1:
            return depth[node]
        if parents[node] == -1:
            depth[node] = 0
        else:
            depth[node] = calculate_depth(parents[node]) + 1
        return depth[node]

    max_depth = 0
    for i in range(n):
        max_depth = max(max_depth, calculate_depth(i))

    return max_depth + 1

Minimum squads โœ…
Company โ€“ IIDE Education Private Limited
Role โ€“ Data Analyst Internship
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/detail/data-analyst-internship-in-mumbai-at-iide-education-private-limited1720264879?utm_source=cp_link&referral=web_share

Company โ€“ Blackcoffer
Role โ€“ Data Science Internship
Exp. โ€“ Fresher
Apply Here โ€“ https://internshala.com/internship/details/work-from-home-data-science-internship-at-blackcoffer1720199867?utm_source=cp_link&referral=web_share

Company โ€“ AskmeOffers.com
Role โ€“ Data Analyst
Exp. โ€“ Fresher
Apply Here โ€“ https://www.linkedin.com/jobs/view/3965852124

Company โ€“ White Gold Bullion Private Limited
Role โ€“ Mis Executive
Exp. โ€“ 0-3 yrs
Apply Here โ€“ https://www.foundit.in/job/mis-executive-white-gold-bullion-private-limited-bengaluru-bangalore-31074671?searchId=b0b11ba6-607b-4d50-91c9-b823e3ce49dd

Company โ€“ Blockchain for the Next Billion
Role โ€“ Data Analyst
Exp. โ€“ 0-5 yrs
Apply Here โ€“ https://www.linkedin.com/jobs/view/3966385446
class Solution {
public:
  int minOperations(vector<int>& nums, int x, int y) {
    int l = 0;
    int r = ranges::max(nums);

    while (l < r) {
      const int m = (l + r) / 2;
      if (isPossible(nums, x, y, m))
        r = m;
      else
        l = m + 1;
    }

    return l;
  }

private:
  bool isPossible(const vector<int>& nums, int x, int y, int m) {
    long long additionalOps = 0;
    for (const int num : nums)
      additionalOps += max(0LL, (num - 1LL * y * m + x - y - 1) / (x - y));
    return additionalOps <= m;
  }
};

Citadel โœ…
bool isposs(vector<int>thr,vector<int>cost,int m,int budget){
    int co=0;
    for(int i=0;i<thr.size();i++){
        if(thr[i]<m){
            if((m-thr[i])%thr[i]==0)co+=((m-thr[i])/thr[i])*cost[i];
           else
            co+=(((m-thr[i])/thr[i])+1)*cost[i];
           
        }
        if(co>budget)return 0;
    }
    return 1;
}
int getMaximumThroughput(vector<int> throughput, vector<int> scaling_cost, int budget) {
priority_queue<int>pq;
int l=0;
// for(auto it:throughput)l=max(l,it);
int r=1e9;
int ans=0;
cout<<isposs(throughput,scaling_cost,6,budget);
while(l<=r){
   int mid=(l+r)/2;
   if(isposs(throughput,scaling_cost,mid,budget)){
       l=mid+1;
       ans=mid;
   }
   else r=mid-1;
}
return ans;
}

Citadel โœ…
โค1
We Are Hiring for 0-2 years!!!

Join us   to start your career in Investment banking.

Looking for BCom/M.com/BBA/BAF/BMS & BE/B.Tech (2022/2023/2024) Freshers or maximum 2years of experience.

Notice : 0-15/30 days


Please come prepared on : Capital Market, Derivative and it's types, Investment Banking, Types of market, KYC, AML, Accounting principles   .


Don't miss this opportunity to showcase your skills!

Email your resume to - Mrunal.Gore01.C@eclerx.com
๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
Photo
#include<bits/stdc++.h>
#define pb push_back
#define int long long
using namespace std;

const int mod = 1e9+7;
const int N = 1e5 + 5;
const int K = 18;

vector<int> get(vector<int> d){
    map<int, int> cnt, swp;
    for(int i = 0; i < d.size(); i++){
        cnt[d[i]]++;
    }
    vector<int> miss;
    for(int i = 1; i <= d.size(); i++){
        if(!cnt[i]) miss.pb(i);
    }

    vector<int> ans = d;
    int ind = 0;
    for(int i = 0; i < d.size(); i++){
        if(cnt[d[i]] > 1 || d[i] > d.size()){
            if(d[i] < miss[ind] && !swp[d[i]]){
                swp[d[i]] = 1;
            }
            else{
                ans[i] = miss[ind];
                ind++;
                cnt[d[i]]--;
            }
        }
    }

    return ans;
}


int32_t main(){
    cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin>>a[i];
    }

    vector<int> ans = get(a);
    for(int i = 0; i < n; i++){
        cout<<ans[i]<<endl;
    }
    return 0;
}

DE Shaw โœ