#include <bits/stdc++.h>
#define ll long long int
using namespace std;
bool prime[100005];
int dp[100005];
ll answer;
bool visited[100005];
vector<int> adjacent[100005];
void dfs1(int u) {
visited[u] = true;
int sum = prime[u] ? 0 : 1;
for (int i = 0; i < adjacent[u].size(); i++) {
int v = adjacent[u][i];
if (!visited[v]) {
dfs1(v);
sum += dp[v];
}
}
dp[u] = sum;
if (prime[u]) dp[u] = 0;
}
void dfs2(int u, int p, int dv) {
visited[u] = true;
if (prime[u]) {
vector<ll> pp;
ll sum = dv;
pp.push_back(dv);
for (int i = 0; i < adjacent[u].size(); i++) {
int v = adjacent[u][i];
if (!visited[v] && v != p) {
dfs2(v, u, 0);
pp.push_back(dp[v]);
sum += dp[v];
}
}
ll val = 0;
for (int i = 0; i < pp.size(); i++) {
val += (sum - pp[i]) * pp[i];
}
val /= 2;
answer += val;
answer += sum;
} else {
for (int i = 0; i < adjacent[u].size(); i++) {
int v = adjacent[u][i];
if (!visited[v] && v != p) {
dfs2(v, u, dv + dp[u] - dp[v]);
}
}
}
}
void Sieve() {
for (int i = 1; i <= 100000; i++) {
prime[i] = true;
}
prime[1] = false;
for (int i = 2; i * i <= 100000; i++) {
if (prime[i]) {
for (int j = i * i; j <= 100000; j += i) {
prime[j] = false;
}
}
}
}
int main() {
Sieve();
int n;
cin >> n;
assert(1 <= n && n <= 100000);
for (int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v;
assert(1 <= u && u <= n);
assert(1 <= v && v <= n);
adjacent[u].push_back(v);
adjacent[v].push_back(u);
}
dfs1(1);
for (int i = 1; i <= n; i++) visited[i] = false;
dfs2(1, 0, 0);
cout << answer << endl;
}
Sprinklr โ
(Search Engine)
#define ll long long int
using namespace std;
bool prime[100005];
int dp[100005];
ll answer;
bool visited[100005];
vector<int> adjacent[100005];
void dfs1(int u) {
visited[u] = true;
int sum = prime[u] ? 0 : 1;
for (int i = 0; i < adjacent[u].size(); i++) {
int v = adjacent[u][i];
if (!visited[v]) {
dfs1(v);
sum += dp[v];
}
}
dp[u] = sum;
if (prime[u]) dp[u] = 0;
}
void dfs2(int u, int p, int dv) {
visited[u] = true;
if (prime[u]) {
vector<ll> pp;
ll sum = dv;
pp.push_back(dv);
for (int i = 0; i < adjacent[u].size(); i++) {
int v = adjacent[u][i];
if (!visited[v] && v != p) {
dfs2(v, u, 0);
pp.push_back(dp[v]);
sum += dp[v];
}
}
ll val = 0;
for (int i = 0; i < pp.size(); i++) {
val += (sum - pp[i]) * pp[i];
}
val /= 2;
answer += val;
answer += sum;
} else {
for (int i = 0; i < adjacent[u].size(); i++) {
int v = adjacent[u][i];
if (!visited[v] && v != p) {
dfs2(v, u, dv + dp[u] - dp[v]);
}
}
}
}
void Sieve() {
for (int i = 1; i <= 100000; i++) {
prime[i] = true;
}
prime[1] = false;
for (int i = 2; i * i <= 100000; i++) {
if (prime[i]) {
for (int j = i * i; j <= 100000; j += i) {
prime[j] = false;
}
}
}
}
int main() {
Sieve();
int n;
cin >> n;
assert(1 <= n && n <= 100000);
for (int i = 0; i < n - 1; i++) {
int u, v;
cin >> u >> v;
assert(1 <= u && u <= n);
assert(1 <= v && v <= n);
adjacent[u].push_back(v);
adjacent[v].push_back(u);
}
dfs1(1);
for (int i = 1; i <= n; i++) visited[i] = false;
dfs2(1, 0, 0);
cout << answer << endl;
}
Sprinklr โ
(Search Engine)
Lost wood
Intuit โ
Intuit โ
#include <bits/stdc++.h>
using namespace std;
int main ()
{
int n;
cin >> n;
vector<int64_t> min_cost(n+2, 0x3f3f3f3f3f3f3f3f);
min_cost[0] = 0;
vector<int> range(n+2), cost(n+2);
for (int i = 1; i <= n+1; i++) {
cin >> range[i];
}
for (int i = 1; i <= n+1; i++) {
cin >> cost[i];
}
for (int i = 1; i <= n+1; i++) {
if (range[i] == 0) continue;
int nxt = min(i + range[i], n+1);
int prev = max(i - range[i] - 1, 0);
int64_t cprev = cost[prev];
for (int j = prev+1; j <= nxt; j++) {
min_cost[j] = min(min_cost[j], min_cost[prev] + cost[i]);
}
}
cout << ((min_cost[n+1] < 0x3f3f3f3f3f3f3f3f) ? min_cost[n+1]: -1) << "\n";
}
Garden
Intuit โ
using namespace std;
int main ()
{
int n;
cin >> n;
vector<int64_t> min_cost(n+2, 0x3f3f3f3f3f3f3f3f);
min_cost[0] = 0;
vector<int> range(n+2), cost(n+2);
for (int i = 1; i <= n+1; i++) {
cin >> range[i];
}
for (int i = 1; i <= n+1; i++) {
cin >> cost[i];
}
for (int i = 1; i <= n+1; i++) {
if (range[i] == 0) continue;
int nxt = min(i + range[i], n+1);
int prev = max(i - range[i] - 1, 0);
int64_t cprev = cost[prev];
for (int j = prev+1; j <= nxt; j++) {
min_cost[j] = min(min_cost[j], min_cost[prev] + cost[i]);
}
}
cout << ((min_cost[n+1] < 0x3f3f3f3f3f3f3f3f) ? min_cost[n+1]: -1) << "\n";
}
Garden
Intuit โ
๐1
Today Anyone give American Express OA?
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Fiserv is Hiring
Role: Technology Analyst Program I
Batch: 2023
Expected CTC: 8 Lpa
Location: Pune
Apply here- https://www.careers.fiserv.com/job/-/-/1758/52099796544
Role: Technology Analyst Program I
Batch: 2023
Expected CTC: 8 Lpa
Location: Pune
Apply here- https://www.careers.fiserv.com/job/-/-/1758/52099796544
Fiserv
Working at Fiserv, Inc.
Browse available job openings at Fiserv, Inc.
โค1๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Anuta Network
Role: Software Engineer Intern
Batch eligible: 2022 and 2023 grads.
Apply: https://www.linkedin.com/jobs/view/3677244584
Role: Software Engineer Intern
Batch eligible: 2022 and 2023 grads.
Apply: https://www.linkedin.com/jobs/view/3677244584
public static int find(int[] arr) {
// Sort the array in ascending order
Arrays.sort(arr);
HashSet<Double> hm=new HashSet<>();
int n = arr.length;
int count = 0;
int left = 0;
int right = n - 1;
while (left < right) {
double avgMaxMin = (arr[left] + arr[right]) / 2.0;
hm.add(avgMaxMin);
left++;
right--;
}
return hm.size();
}
Amazon OAโ
// Sort the array in ascending order
Arrays.sort(arr);
HashSet<Double> hm=new HashSet<>();
int n = arr.length;
int count = 0;
int left = 0;
int right = n - 1;
while (left < right) {
double avgMaxMin = (arr[left] + arr[right]) / 2.0;
hm.add(avgMaxMin);
left++;
right--;
}
return hm.size();
}
Amazon OAโ
public static String lexicographicallyMaxString(String inputStr) {
char[] chars = inputStr.toCharArray();
int n = chars.length;
HashSet<Character> c=new HashSet<>();
Map<Character, Integer> charCount = new HashMap<>();
for (char ch : chars) {
charCount.put(ch, charCount.getOrDefault(ch, 0) + 1);
}
PriorityQueue<Character> pq = new PriorityQueue<>((a, b) -> a-b);
for (char ch : charCount.keySet()) {
pq.add(ch);
c.add(ch);
}
StringBuilder sb = new StringBuilder();
while (!pq.isEmpty()) {
char currentChar = pq.poll();
if(c.contains(currentChar)){
sb.append(currentChar);
c.remove(currentChar);
}
}
return sb.toString();
}
Modify the string โ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: Jade Global Software
Role: Associate Analyst
Batch eligible: 2023 grads only
Apply: https://myanatomy.in/events-and-hackathon/jade-global-software/jade-global-software-1970-01-01
P.S: Only apply if you donโt have any offers.
Role: Associate Analyst
Batch eligible: 2023 grads only
Apply: https://myanatomy.in/events-and-hackathon/jade-global-software/jade-global-software-1970-01-01
P.S: Only apply if you donโt have any offers.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Sandvine is Hiring !!
Role: Software Engineer
Batch: 2023
Expected CTC: 7-8 Lpa
Apply here-
https://recruiting2.ultipro.com/PRO1053PROC/JobBoard/d6eed263-4950-420d-b9f8-5b1a441c931e/OpportunityDetail?opportunityId=74743e98-9fb6-40c8-bb52-96d30db04bf8&postingId=7b38edfe-ed40-4e72-a0d3-202084aabe3a
Role: Software Engineer
Batch: 2023
Expected CTC: 7-8 Lpa
Apply here-
https://recruiting2.ultipro.com/PRO1053PROC/JobBoard/d6eed263-4950-420d-b9f8-5b1a441c931e/OpportunityDetail?opportunityId=74743e98-9fb6-40c8-bb52-96d30db04bf8&postingId=7b38edfe-ed40-4e72-a0d3-202084aabe3a
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
BOX ID Systems hiring software developer
Apply : https://www.showwcase.com/job/8243-software-developer
Apply : https://www.showwcase.com/job/8243-software-developer
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: American Express
Role: Software Engineer
Batch eligible: 2024 grads only.
Apply: https://aexp.eightfold.ai/careers/job/17212750
Note: M.Tech, B.Tech + M.Tech, MCA and M.Sc passing out in 2024 grads are eligible only. (Only Master degree)
Role: Software Engineer
Batch eligible: 2024 grads only.
Apply: https://aexp.eightfold.ai/careers/job/17212750
Note: M.Tech, B.Tech + M.Tech, MCA and M.Sc passing out in 2024 grads are eligible only. (Only Master degree)
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Trilogy Innovations Hiring SDE Intern !!
Batch: 2025
Stipend: Rs 75,000 per month
Location: Remote
Last day to Register: 30th July
Test Date: 6th August
Apply Now: https://forms.gle/bJVvL3YqP6c6pr5q9
Batch: 2025
Stipend: Rs 75,000 per month
Location: Remote
Last day to Register: 30th July
Test Date: 6th August
Apply Now: https://forms.gle/bJVvL3YqP6c6pr5q9
Google Docs
Trilogy Innovations: Intern hiring (6th August 12 PM - 2 PM)
Trilogy is one of the largest privately held software companies in the world. Every year, we hire and train dozens of new graduates for an important role: solving the most complex, biggest problems so that our products are compelling and valuable. You willโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Company Name: GE Healthcare
Role: Software Engineer Specialist
Batch eligible: 2022 and 2023 grads.
Apply: https://jobs.gecareers.com/healthcare/global/en/job/R3724264/Software-Engineering-Specialist
Role: Software Engineer Specialist
Batch eligible: 2022 and 2023 grads.
Apply: https://jobs.gecareers.com/healthcare/global/en/job/R3724264/Software-Engineering-Specialist
GE Aerospace
Career Opportunities at GE Aerospace
Find yourself a world-changing job. The world is a place of increasingly complex challenges and itโs looking to us to solve them. Do you have the vision and the ambition for this kind of challenge? Join us!
Cisco Interview Experience :
1)First introduction
2)Then she asked about course like i have done cisco ccna course that
3)Then about web dev internship
4)College Project Explain
5)About python
6)Why python
7)She gave a task like CAT BAT PAT DAT
output should be like
["CA", "BA", "PA", "DA"]
8)Then 2 questions about dependency
9)Global and local variables
10)The she gave me 2 strings and asked me how to print them in one line
11)Without using concat
12)OOPS
13)Different between python and java
14)Reverse of a number
15)Swapping
16)Why reactjs
17)API
18)Backend coding
19)If u are from ECE then they will ask logic of code
Any Questions
1)First introduction
2)Then she asked about course like i have done cisco ccna course that
3)Then about web dev internship
4)College Project Explain
5)About python
6)Why python
7)She gave a task like CAT BAT PAT DAT
output should be like
["CA", "BA", "PA", "DA"]
8)Then 2 questions about dependency
9)Global and local variables
10)The she gave me 2 strings and asked me how to print them in one line
11)Without using concat
12)OOPS
13)Different between python and java
14)Reverse of a number
15)Swapping
16)Why reactjs
17)API
18)Backend coding
19)If u are from ECE then they will ask logic of code
Any Questions
๐2