#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void dfs(int v, int pre, vector<vector<int>>& T, vector<ll>& sz, ll n, ll& ans) {
ll sum1 = 0, sum2 = 0;
for (int c : T[v]) {
if (c == pre) continue;
dfs(c, v, T, sz, n, ans);
sum1 += sz[c];
sum2 += sz[c] * sz[c];
sz[v] += sz[c];
}
sum1 += n - sz[v];
sum2 += (n - sz[v]) * (n - sz[v]);
ans -= (sum1 * sum1 - sum2) >> 1;
}
int countTriplets(int treeNodes, vector<int>& treeFrom, vector<int>& treeTo) {
vector<vector<int>> T(treeNodes + 1);
for (int i = 0; i < treeNodes - 1; i++) {
T[treeFrom[i]].push_back(treeTo[i]);
T[treeTo[i]].push_back(treeFrom[i]);
}
ll ans = treeNodes * (treeNodes - 1) * (treeNodes - 2) / 6;
vector<ll> sz(treeNodes + 1, 1);
dfs(1, -1, T, sz, treeNodes, ans);
return ans;
}
int main() {
int treeNodes = 5;
vector<int> treeFrom = {1, 1, 2, 2};
vector<int> treeTo = {2, 5, 3, 4};
cout << countTriplets(treeNodes, treeFrom, treeTo) << '\n';
return 0;
}
Count tree path
Gamekraft โ
using namespace std;
using ll = long long;
void dfs(int v, int pre, vector<vector<int>>& T, vector<ll>& sz, ll n, ll& ans) {
ll sum1 = 0, sum2 = 0;
for (int c : T[v]) {
if (c == pre) continue;
dfs(c, v, T, sz, n, ans);
sum1 += sz[c];
sum2 += sz[c] * sz[c];
sz[v] += sz[c];
}
sum1 += n - sz[v];
sum2 += (n - sz[v]) * (n - sz[v]);
ans -= (sum1 * sum1 - sum2) >> 1;
}
int countTriplets(int treeNodes, vector<int>& treeFrom, vector<int>& treeTo) {
vector<vector<int>> T(treeNodes + 1);
for (int i = 0; i < treeNodes - 1; i++) {
T[treeFrom[i]].push_back(treeTo[i]);
T[treeTo[i]].push_back(treeFrom[i]);
}
ll ans = treeNodes * (treeNodes - 1) * (treeNodes - 2) / 6;
vector<ll> sz(treeNodes + 1, 1);
dfs(1, -1, T, sz, treeNodes, ans);
return ans;
}
int main() {
int treeNodes = 5;
vector<int> treeFrom = {1, 1, 2, 2};
vector<int> treeTo = {2, 5, 3, 4};
cout << countTriplets(treeNodes, treeFrom, treeTo) << '\n';
return 0;
}
Count tree path
Gamekraft โ
๐ฅ1
const char* oldest(struct companyProfile* profiles, int n)
{
int maxSize=profiles[0].size;
const char* ans=profiles[0].name;
for (int i=1;i<n;i++)
{
if (profiles[i].size>maxSize)
{
maxSize=profiles[i].size;
ans=profiles[i].name;
}
}
return ans;
}
float average(struct companyProfile* profiles, int n)
{
if (n==0) return 0.0f;
int ans = 0;
for (int i=0;i<n;i++)
{
ans+=profiles[i].size;
}
return (float)ans/n;
}
Company Profiles โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Quadeye Hiring Campus Engineer -System Engineer
https://www.quadeye.com/careers/?gh_jid=5635516002&utm_medium=jobboard&utm_source=linkedin&gh_src=4eab9f2d2
https://www.quadeye.com/careers/?gh_jid=5635516002&utm_medium=jobboard&utm_source=linkedin&gh_src=4eab9f2d2
Quadeye
Careers - Quadeye
Careers at Quadeye Securities. Join our Team!
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
https://www.linkedin.com/jobs/view/4004773127/
Walk-In For "Only Freshers (Except BE / B.Tech)-Data" at Pune Location on 25th Aug
Note: Please carry copy of this email to the venue and make sure you register your application before attending the walk-in. Please mention Candidate ID on top of the Resume ***Please use below link to apply and register your application.
https://career.infosys.com/jobdesc?jobReferenceCode=PROGEN-HRODIRECT-188901
Interview Information:
Interview Date: 25th Aug 2024
Interview Time: 09:30 Am till 12:30 Pm
Interview Venue - Pune:
Pune Venue:
Infosys BPM limited,
Taluka Mulshi,
Plot No. 1, Pune, Phase 1,
Hinjawadi Rajiv Gandhi infotech Park,
Hinjawadi, Pune,
Maharashtra 411057
Documents to Carry:
Please carry 2 set of updated CV(Hard Copy).
Please carry Face Mask**.
Carry any 2 photo Identity proof (PAN Card/Driving License/Voters ID card/Passport).
All original education documents need to be available for verification. (10th, 12th, Graduation (Sem Wise Marksheet, CMM. Provisional and Original Degree)
Job Description:
Job Location: Pune
Qualification: Any Graduate B-Com, BBA, BCA (Except BE / Technical)
Shifts: 24*7
Experience: 0-1 Years
Role: Process Executive
NOTE: Only looking for Freshers & Talents should have graduation completion certificate and mark sheets for onboarding.
Basic requirements:
Decent communication.
Ready to work in night shift
Work from office.
Roles & Responsibilities:
Candidate needs to have 15 years of full time education
Proficient with basic computer knowledge
Candidate should be flexible to work in 24*7 environments, comfortable to work in night shifts (Rotational)
Excellent verbal, written communication, interpretation and active listening skills
Ability to quickly and efficiently assimilate process knowledge
Effective probing & analyzing skills and capable of doing a multi-tasking of voice & data entry
Should be comfortable working from office
Walk-In For "Only Freshers (Except BE / B.Tech)-Data" at Pune Location on 25th Aug
Note: Please carry copy of this email to the venue and make sure you register your application before attending the walk-in. Please mention Candidate ID on top of the Resume ***Please use below link to apply and register your application.
https://career.infosys.com/jobdesc?jobReferenceCode=PROGEN-HRODIRECT-188901
Interview Information:
Interview Date: 25th Aug 2024
Interview Time: 09:30 Am till 12:30 Pm
Interview Venue - Pune:
Pune Venue:
Infosys BPM limited,
Taluka Mulshi,
Plot No. 1, Pune, Phase 1,
Hinjawadi Rajiv Gandhi infotech Park,
Hinjawadi, Pune,
Maharashtra 411057
Documents to Carry:
Please carry 2 set of updated CV(Hard Copy).
Please carry Face Mask**.
Carry any 2 photo Identity proof (PAN Card/Driving License/Voters ID card/Passport).
All original education documents need to be available for verification. (10th, 12th, Graduation (Sem Wise Marksheet, CMM. Provisional and Original Degree)
Job Description:
Job Location: Pune
Qualification: Any Graduate B-Com, BBA, BCA (Except BE / Technical)
Shifts: 24*7
Experience: 0-1 Years
Role: Process Executive
NOTE: Only looking for Freshers & Talents should have graduation completion certificate and mark sheets for onboarding.
Basic requirements:
Decent communication.
Ready to work in night shift
Work from office.
Roles & Responsibilities:
Candidate needs to have 15 years of full time education
Proficient with basic computer knowledge
Candidate should be flexible to work in 24*7 environments, comfortable to work in night shifts (Rotational)
Excellent verbal, written communication, interpretation and active listening skills
Ability to quickly and efficiently assimilate process knowledge
Effective probing & analyzing skills and capable of doing a multi-tasking of voice & data entry
Should be comfortable working from office
Linkedin
Infosys BPM hiring Walk-In For "Only Freshers (Except BE / B.Tech)-Data" at Pune Location on 25th Aug in Pune, Maharashtra, Indiaโฆ
Posted 7:01:26 AM. EXCLUSIVE WALK-IN DRIVE FOR " Only Freshers (Except BE / B.Tech) - Data " at Pune on 25th AugโฆSee this and similar jobs on LinkedIn.
๐4
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Duck Creek Technologies Hiring Jr. ASE
https://duckcreek.wd1.myworkdayjobs.com/en-US/duckcreekcareers/job/Remote-India/Junior-Associate-Software-Engineer_REQID54365-1?source=LinkedIn
https://duckcreek.wd1.myworkdayjobs.com/en-US/duckcreekcareers/job/Remote-India/Junior-Associate-Software-Engineer_REQID54365-1?source=LinkedIn
๐2
def smallestString(N, A):
def is_substring(sub, strings):
return any(sub in s for s in strings)
alphabet = 'abcdefghijklmnopqrstuvwxyz'
for c in alphabet:
if not is_substring(c, A):
return c
for c1 in alphabet:
for c2 in alphabet:
s = c1 + c2
if not is_substring(s, A):
return s
return ""
Smallest substring Egnyte โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
T-Machine | 2024 - Online Test - Slot Picker
https://docs.google.com/forms/d/e/1FAIpQLScBG4kXoBdGvc4NGz1t7OfQHU-FhS2kB8KkifVttSylSt098g/viewform?pli=1
https://docs.google.com/forms/d/e/1FAIpQLScBG4kXoBdGvc4NGz1t7OfQHU-FhS2kB8KkifVttSylSt098g/viewform?pli=1
Google Docs
T-Machine | 2024 - Online Test - Slot Picker
Please read carefully before filling out this form:
First Round: This is your first round and followed by that you will be having 2 Technical and 1 HR Round
Eligibility: This form is to be filled out only by applicants who applied for T-Machine's Softwareโฆ
First Round: This is your first round and followed by that you will be having 2 Technical and 1 HR Round
Eligibility: This form is to be filled out only by applicants who applied for T-Machine's Softwareโฆ
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Acciojob hiring Sales Associate
Position: Sales Associate
Notice Period: Immediate joiners
Location: Gurgaon or Hyderabad (In-office)
Salary: 5 LPA Fixed + 3 LPA Incentives
https://tally.so/r/wdlbVN?medium=KN
Position: Sales Associate
Notice Period: Immediate joiners
Location: Gurgaon or Hyderabad (In-office)
Salary: 5 LPA Fixed + 3 LPA Incentives
https://tally.so/r/wdlbVN?medium=KN
Tally Forms
AccioJob
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>Social Media suggestions
using namespace std;
int count(const unordered_set<int> &a, const unordered_set<int> &b) {
int r = 0;
for (int x : a) {
r += b.count(x);
}
return r;
}
void better(int& r, int &num, int id, int count) {
if (r < 0 or (num < count or ((num == count) && (r > id)))) {
r = id;
num = count;
}
}
vector<int> getRecommendedFriends(int n, const vector<vector<int>> friendships) {
vector<int> r(n, -1), num(n, 0);
vector<unordered_set<int>> con(n);
for (const auto& v : friendships) {
con[v[0]].insert(v[1]);
con[v[1]].insert(v[0]);
}
for (int i = 0; i<n; ++i) {
for (auto t1 = con[i].begin(); t1 != con[i].end(); ++t1) {
for (auto t2 = next(t1); t2 != con[i].end(); ++t2) {
if (con[*t1].count(*t2) == 0) {
const int x = count(con[*t1], con[*t2]);
better(r[*t1], num[*t1], *t2, x);
better(r[*t2], num[*t2], *t1, x);
}
}
}
}
for (int i = 0; i < n; ++i) {
if (r[i] < 0) {
int j = 0;
for (; j < n && (j == i) || con[i].count(j); ++j);
if (j < n) {
r[i] = j;
}
}
}
return r;
}
BNY Mellon โ
class Solution {
public:
vector<int> countServers(int n, vector<vector<int>>& logs, int x, vector<int>& queries) {
sort(logs.begin(), logs.end(), [](const auto& a, const auto& b) {
return a[1] < b[1];
});
int m = queries.size();
vector<pair<int, int>> qs(m);
for (int i = 0; i < m; ++i) {
qs[i] = {queries[i], i};
}
sort(qs.begin(), qs.end());
unordered_map<int, int> cnt;
vector<int> ans(m);
int j = 0, k = 0;
for (auto& [r, i] : qs) {
int l = r - x;
while (k < logs.size() && logs[k][1] <= r) {
++cnt[logs[k++][0]];
}
while (j < logs.size() && logs[j][1] < l) {
if (--cnt[logs[j][0]] == 0) {
cnt.erase(logs[j][0]);
}
++j;
}
ans[i] = n - cnt.size();
}
return ans;
}
};
BNY Mellon โ
LOG ANALYSIS 2
๐๐ฆ ๐๐น๐ด๐ผ ๐ป ๐ ใ๐๐ผ๐บ๐ฝ๐ฒ๐๐ถ๐๐ถ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ด๐ฟ๐ฎ๐บ๐บ๐ถ๐ป๐ดใ
Photo
#include <bits/stdc++.h>
using namespace std;
long long getMaxReliability(int maxConnections, int gnodes, vector<int> g_from, vector<int> g_to, vector<int> g_weight) {
vector<vector<pair<int, int>>> adj(gnodes);
for (int i = 0; i < gnodes - 1; ++i) {
adj[g_from[i]].emplace_back(g_to[i], g_weight[i]);
adj[g_to[i]].emplace_back(g_from[i], g_weight[i]);
}
function<array<long long, 2>(int, int)> dfs = [&](int cur, int parent) {
array<long long, 2> ans{};
vector<long long> take, skip, diff;
for (auto& [next, w] : adj[cur]) {
if (parent != next) {
auto [not_full, full] = dfs(next, cur);
take.push_back(not_full + w);
skip.push_back(full);
diff.push_back(take.back() - skip.back());
}
}
int n = int(diff.size());
nth_element(diff.begin(), diff.begin() + maxConnections - 1, diff.end(), greater<>());
ans[0] = accumulate(diff.begin(), diff.begin() + min(maxConnections, n), 0LL) + accumulate(skip.begin(), skip.end(), 0LL);
if (n && n >= maxConnections) {
ans[1] = ans[0];
ans[0] -= *min_element(diff.begin(), diff.begin() + maxConnections);
}
return ans;
};
auto ans = dfs(0, -1);
// cout << "DFS Result - Not Full: " << ans[0] << ", Full: " << ans[1] << endl;
return max(ans[0], ans[1]);
}
Get MaxReliability
Gamekraftโ
๐1
#include <bits/stdc++.h>
using namespace std;
int solve(vector<int>& err, int p, int q) {
make_heap(err.begin(), err.end());
pop_heap(err.begin(), err.end());
int base_line = 0;
int operations = 0;
while (err.back() > base_line) {
base_line += q;
int max_err = err.back();
err.pop_back();
err.push_back(max_err - (p - q));
push_heap(err.begin(), err.end());
operations += 1;
pop_heap(err.begin(), err.end());
}
return operations;
}