๐—–๐—ฆ ๐—”๐—น๐—ด๐—ผ ๐Ÿ’ป ๐ŸŒ ใ€Ž๐—–๐—ผ๐—บ๐—ฝ๐—ฒ๐˜๐—ถ๐˜๐—ถ๐˜ƒ๐—ฒ ๐—ฃ๐—ฟ๐—ผ๐—ด๐—ฟ๐—ฎ๐—บ๐—บ๐—ถ๐—ป๐—ดใ€
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
โœ…โœ…โœ…#HackerRank Department Summary - SQL HackerRank Solution

select d.name, count(unique(e.id)) as c
from department d, employee e
where d.id = e.dept_id
group by d.name
order by c desc, d.name;

select d.name, 0
from department d
left outer join employee e on d.id = e.dept_id
where e.id is null
group by d.name
order by d.name;

โœ… Share in ur College WhatsApp Groups
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int>>adj[1000001];

int main(){
int n;
cin>>n;
unordered_map<int,int>mp;
for(int i=0;i<n;++i){
int x;
cin>>x;
mp[x]=INT_MAX;
}
int e;
cin>>e;
for(int i=0;i<e;++i){
int x,y,d;
cin>>x>>y>>d;
adj[x].push_back({y,d});
}
int src,dest;
cin>>src>>dest;
set<pair<int,int>>s;
mp[src]=0;
s.insert({0,src});
while(!s.empty()){
pair<int,int>tmp=*(s.begin());
s.erase(s.begin());
int u=tmp.second;
for(auto i=adj[u].begin();i!=adj[u].end();++i){
int v=(*i).first;
int weight=(*i).second;
if(mp[v]>mp[u]+weight){
if(mp[v]!=INT_MAX)
s.erase(s.find({mp[v],v}));
mp[v]=mp[u]+weight;
s.insert({mp[v],v});
}
}
}
if(mp[dest]==INT_MAX)
cout<<"-1"<<endl;
else
cout<<mp[dest]<<endl;
return 0;
}

Juspay (C++)โœ…
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[1000001];
void solve(int src,int dest,unordered_map<int,int>&mp){
mp[src]=1;
for(int i=0;i<adj[src].size();++i){
if(!mp[adj[src][i]]){
solve(adj[src][i],dest,mp);
}
}
}

int main(){
int n;
cin>>n;
unordered_map<int,int>mp;
for(int i=0;i<n;++i){
int x;
cin>>x;
mp[x]=0;
}
int e;
cin>>e;

for(int i=0;i<e;++i){
int x,y;
cin>>x>>y;
adj[x].push_back(y);
}
int src,dest;
cin>>src>>dest;
solve(src,dest,mp);
cout<<mp[dest]<<endl;
return 0;
}

Juspay (C++)โœ…
๐Ÿ‘1
void rearrange(int arr[], int n)
{
int temp[n];
int small = 0, large = n - 1;n
int flag = true;
for (int i = 0; i < n; i++) {
if (flag)
temp[i] = arr[large--];
else
temp[i] = arr[small++];

flag = !flag;
}
for (int i = 0; i < n; i++)
arr[i] = temp[i];
}

Alternate Prefix Sums โœ