You are given a rooted tree of N vertices and an array A of N integers A[i] is the parent of the vertex (i+1 or 0 if the vertex (i+1) is the root.
For each vertex V from 1 to N, the answer K is the total number of subsets of vertices with the LCA (lowest common ancestor) equal to V Since the of K can be large calculate it modulo 10 ^ 9 + 7
Let there be an integer array Res where Res[i] contains the answer for (I + 1)th vertex, Find the array Res
Notes:
โข The lowest common ancestor (LCA) is defined for X nodes A1, A2,.... Ax as the lowest node in the tree that has all A1 A2..... Ax as descendants (where we allow a node to be a descendant of itself)
Input Formate
The first line contains an integer N denoting the number of elements in A
Each line 1 of the N subsequent lines (where 0<=i<N) contains an integer
describing All It is given that A[i] denotes the parent of the vertex (i+1) or 0
If the vertex (i+1) is the root
const int N = 100005;
const int MOD = 1e9 + 7;
int a[N], dp[N], res[N];
vector<int> g[N];
void dfs(int u) {
dp[u] = 1;
for (int v : g[u]) {
dfs(v);
dp[u] = 1ll * dp[u] * (dp[v] + 1) % MOD;
}
res[u] = (1ll * dp[u] * (1 << g[u].size()) - 1 + MOD) % MOD;
}
vector<int> functionName(int n,vector<int>A)
{
g=A;
dfs(1);
return res;
}
Language c++โ
Infosys
For each vertex V from 1 to N, the answer K is the total number of subsets of vertices with the LCA (lowest common ancestor) equal to V Since the of K can be large calculate it modulo 10 ^ 9 + 7
Let there be an integer array Res where Res[i] contains the answer for (I + 1)th vertex, Find the array Res
Notes:
โข The lowest common ancestor (LCA) is defined for X nodes A1, A2,.... Ax as the lowest node in the tree that has all A1 A2..... Ax as descendants (where we allow a node to be a descendant of itself)
Input Formate
The first line contains an integer N denoting the number of elements in A
Each line 1 of the N subsequent lines (where 0<=i<N) contains an integer
describing All It is given that A[i] denotes the parent of the vertex (i+1) or 0
If the vertex (i+1) is the root
const int N = 100005;
const int MOD = 1e9 + 7;
int a[N], dp[N], res[N];
vector<int> g[N];
void dfs(int u) {
dp[u] = 1;
for (int v : g[u]) {
dfs(v);
dp[u] = 1ll * dp[u] * (dp[v] + 1) % MOD;
}
res[u] = (1ll * dp[u] * (1 << g[u].size()) - 1 + MOD) % MOD;
}
vector<int> functionName(int n,vector<int>A)
{
g=A;
dfs(1);
return res;
}
Language c++โ
Infosys
๐4
You are given Q queries, Each query contains a number N=Quer[i] denoting the ith query.
You have to find M such that:
1 <= M <= N
M|M+1|....| N is as maximum as possible where | is the OR bitwise operation.
M is as maximum as possible.
The answer to this query is the value of M.
Find the sum of answers to all queries modulo 109+7
Note:
A bitwise OR is a binary operation that takes two-bit patterns of equal length and performs the logical inclusive OR operation on each pair of corresponding bits. The result in each position is 0 if both bits are 0, while otherwise, the result is 1.
For example, 0101 (decimal 5) OR 0011 (decimal 3) =0111(decimal 7 )
Input formate:
The first line contains an integer, Q, denoting the number of elements in quer
Each line i of the Q subsequent lines (where 0 <= 1 < Q ) contains an integer describing Quer[i]
const int mod = 1e9 + 7;
int f(int N) {
return (1 << (bitset<32>(N).count() - 1)) - 1;
}
int solve(int Q,vector<int>Quer)
{
int ans = 0;
for(int i=0;i<Q;i++)
ans += f(Quer[i]);
ans %= mod;
}
return ans;
}
Language c++โ
Infosys
You have to find M such that:
1 <= M <= N
M|M+1|....| N is as maximum as possible where | is the OR bitwise operation.
M is as maximum as possible.
The answer to this query is the value of M.
Find the sum of answers to all queries modulo 109+7
Note:
A bitwise OR is a binary operation that takes two-bit patterns of equal length and performs the logical inclusive OR operation on each pair of corresponding bits. The result in each position is 0 if both bits are 0, while otherwise, the result is 1.
For example, 0101 (decimal 5) OR 0011 (decimal 3) =0111(decimal 7 )
Input formate:
The first line contains an integer, Q, denoting the number of elements in quer
Each line i of the Q subsequent lines (where 0 <= 1 < Q ) contains an integer describing Quer[i]
const int mod = 1e9 + 7;
int f(int N) {
return (1 << (bitset<32>(N).count() - 1)) - 1;
}
int solve(int Q,vector<int>Quer)
{
int ans = 0;
for(int i=0;i<Q;i++)
ans += f(Quer[i]);
ans %= mod;
}
return ans;
}
Language c++โ
Infosys
given an array A of size N.
You are allowed to choose at most one pair of elements such that distance (defined as the difference of their indices) is at most K and swap them.
Find the smallest lexicographical array possible after
Notes:
An array x is lexicographically smaller than an array y if there exists an index i such that xi <y i1 and x_{j} = y_{j} for all 0 <= j < i . Less formally, at the first index i in which they differ xi < yi
Input Formats@gman
The First-line contains Integers N Ea an integer, N, denoting the line i of the N subsequent lines (where describing A[i]. of elements in A. N) contains an integer
The next line contains an integer, K, denoting the upper bound on distance of index.
Constraints
Here as all the array values are equal swapping will not change the final result,
Here A=[5,4,3,2,11 K we can swap elements at index 0 and index 3 which makes A= [2,4,3,5,1].
Here A=[2,1,1,1,1] K we can swap elements at index 0 and index 3 chat which makes A= [1.1.1.2.11
bool swapped = false;
for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j <= min(i + K, N - 1); j++) {
if (A[i] > A[j]) {
swap(A[i], A[j]);
swapped = true;
break;
}
}
if (swapped) break;
}
if (!swapped) return A;
else return A;
C++โ
Infosys
You are allowed to choose at most one pair of elements such that distance (defined as the difference of their indices) is at most K and swap them.
Find the smallest lexicographical array possible after
Notes:
An array x is lexicographically smaller than an array y if there exists an index i such that xi <y i1 and x_{j} = y_{j} for all 0 <= j < i . Less formally, at the first index i in which they differ xi < yi
Input Formats@gman
The First-line contains Integers N Ea an integer, N, denoting the line i of the N subsequent lines (where describing A[i]. of elements in A. N) contains an integer
The next line contains an integer, K, denoting the upper bound on distance of index.
Constraints
Here as all the array values are equal swapping will not change the final result,
Here A=[5,4,3,2,11 K we can swap elements at index 0 and index 3 which makes A= [2,4,3,5,1].
Here A=[2,1,1,1,1] K we can swap elements at index 0 and index 3 chat which makes A= [1.1.1.2.11
bool swapped = false;
for (int i = 0; i < N - 1; i++) {
for (int j = i + 1; j <= min(i + K, N - 1); j++) {
if (A[i] > A[j]) {
swap(A[i], A[j]);
swapped = true;
break;
}
}
if (swapped) break;
}
if (!swapped) return A;
else return A;
C++โ
Infosys
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ด Company:- Clari
Job Role :- Software Engineer- Backend
Experienced Required : - 3 to 5 years
Eligibility : Any Degree Apply
Salary Range :- 15 to 30 LPA+ (Depend upon Experience)
Job Location - Bengaluru
โ๏ธ Apply Link : https://bit.ly/3GSJ2xR
Job Role :- Software Engineer- Backend
Experienced Required : - 3 to 5 years
Eligibility : Any Degree Apply
Salary Range :- 15 to 30 LPA+ (Depend upon Experience)
Job Location - Bengaluru
โ๏ธ Apply Link : https://bit.ly/3GSJ2xR
jobs.lever.co
Clari - Software Engineer- Backend
About the Role As a backend engineer, you'll work to build scalable applications designed to service millions of mobile and web-based information workers. Youโll work closely with product managers, designers, and others in a cross-functional environment onโฆ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
KPMG (2021/2022) Batch
Qualification: MBA
https://ejgk.fa.em2.oraclecloud.com/hcmUI/CandidateExperience/en/sites/CX_1/job/22000AHB/?utm_medium=jobshare
Qualification: MBA
https://ejgk.fa.em2.oraclecloud.com/hcmUI/CandidateExperience/en/sites/CX_1/job/22000AHB/?utm_medium=jobshare
KPMG India
Analyst
#KI Hiring MBA HR Freshers(21-22 batch only) to be a part of our Talent Acquisition Team. Are you aspiring to start an exciting career in Talent Acquisition? Come & Join our amazing TA team. Job Location : Mumbai, Bangalore, Gurgaon & Pune locations.
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
MountBlue is hiring for Software Development Engineer role (2022 and 2023 grads eligible)
https://careers.mountblue.io/sde
https://careers.mountblue.io/sde
careers.mountblue.io
Careers @ MountBlue
Register @ MountBlue
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
๐ด Company:- MasterCard
Job Role :- Software Engineer II
Experienced Required : - 2 years+
Eligibility : Any Degree Apply
Salary Range :- 30 to 60 LPA+ (Depend upon Experience)
Job Location - Pune
โ๏ธ Apply Link : https://mstr.cd/3wpnIeQ
Job Role :- Software Engineer II
Experienced Required : - 2 years+
Eligibility : Any Degree Apply
Salary Range :- 30 to 60 LPA+ (Depend upon Experience)
Job Location - Pune
โ๏ธ Apply Link : https://mstr.cd/3wpnIeQ
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
OKCL OFF Campus Hiring
Batch: 2019-2023
Salary: 3.9-9LPA
http://okcl.org/careers/project-trainee-recruitment-2023
For MBA Hiring(Managament Trainee)
Batch : 2023-2021
http://okcl.org/careers/management-trainee-recruitment-2022-23
Batch: 2019-2023
Salary: 3.9-9LPA
http://okcl.org/careers/project-trainee-recruitment-2023
For MBA Hiring(Managament Trainee)
Batch : 2023-2021
http://okcl.org/careers/management-trainee-recruitment-2022-23
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Software Development Engineer - Campus Hire - Summer Intern - Job ID: 2146508 | Amazon.jobs
https://www.amazon.jobs/en/jobs/2146508/software-development-engineer-campus-hire-summer-intern
https://www.amazon.jobs/en/jobs/2146508/software-development-engineer-campus-hire-summer-intern
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Thinkitive Job Application Form Year 2023 !!!
Batch 2022/2021 &Experience
https://docs.google.com/forms/d/e/1FAIpQLSfOiQt0I5G2J5pp_tFRPpYb9ZVZzGMwFqQfPDQq_6_Vak_o1w/viewform
Batch 2022/2021 &Experience
https://docs.google.com/forms/d/e/1FAIpQLSfOiQt0I5G2J5pp_tFRPpYb9ZVZzGMwFqQfPDQq_6_Vak_o1w/viewform
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
CloudSEK is hiring for SDET Intern role (Batch eligible: 2022 grads only)
Apply Link: https://www.linkedin.com/jobs/view/3449921545
Apply Link: https://www.linkedin.com/jobs/view/3449921545
Linkedin
CloudSEK hiring Intern - SDET in Bengaluru, Karnataka, India | LinkedIn
Posted 7:54:44 AM. WHO ARE WE?
We are a bunch of super enthusiastic, passionate, and highly driven people, working toโฆSee this and similar jobs on LinkedIn.
We are a bunch of super enthusiastic, passionate, and highly driven people, working toโฆSee this and similar jobs on LinkedIn.
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
ICIMS is hiring for Software Engineer Intern (2023 and 2024 batch can try)
https://careers.icims.com/careers-home/jobs/3971?lang=en-gb
https://careers.icims.com/careers-home/jobs/3971?lang=en-gb
๐1
int n = s.length();
Map<Character, Integer> f = new HashMap<>();
for (int i = 0; i < n; i++)
{
char chh = s.charAt(i);
int count = f.getOrDefault(chh, 0);
f.put(chh, count + 1);
}
int m = t.length();
Map<Character, Integer> f = new HashMap<>();
for (int i = 0; i < m; i++)
{
char chh = t.charAt(i);
int count = f.getOrDefault(chh, 0);
f.put(chh, count + 1);
}
int result = Integer.MAX_VALUE;
for (char key : f.keySet())
{
int c = freqS.getOrDefault(key, 0);
int r = f.get(key);
result = Math.min(result, c / r);
}
return result == Integer.MAX_VALUE ? -1 : result;
Amazon SDE1โ
Map<Character, Integer> f = new HashMap<>();
for (int i = 0; i < n; i++)
{
char chh = s.charAt(i);
int count = f.getOrDefault(chh, 0);
f.put(chh, count + 1);
}
int m = t.length();
Map<Character, Integer> f = new HashMap<>();
for (int i = 0; i < m; i++)
{
char chh = t.charAt(i);
int count = f.getOrDefault(chh, 0);
f.put(chh, count + 1);
}
int result = Integer.MAX_VALUE;
for (char key : f.keySet())
{
int c = freqS.getOrDefault(key, 0);
int r = f.get(key);
result = Math.min(result, c / r);
}
return result == Integer.MAX_VALUE ? -1 : result;
Amazon SDE1โ
๐2
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
ServiceNow hiring through their Women Code to Win Program. (Only for female candidates)
2023, 2024 and 2025 grads can apply.
Apply Link: https://unstop.com/o/6hDv8C0?lb=VM0FqwL
2023, 2024 and 2025 grads can apply.
Apply Link: https://unstop.com/o/6hDv8C0?lb=VM0FqwL
Unstop
ServiceNow Code to Win 2023 by ServiceNow! | 2022 // Unstop (formerly Dare2Compete)
ServiceNow invites female engineering students pursuing a career in technology to create impact and help solve some of the most challenging real-life problems with ServiceNow Women Code to Win 2023 - India! Apply before 1st Feb'23! | 2022
๐1
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Hexaview QA fresher's hiring (2020, 2021 and 2022 grads eligible)
First 6 months: 20k, then 3.6 LPA.
Also 2 year bond.
Fill if interested: https://forms.gle/HiWTv5r73P6pYYav5
First 6 months: 20k, then 3.6 LPA.
Also 2 year bond.
Fill if interested: https://forms.gle/HiWTv5r73P6pYYav5
Google Docs
Hexaview QA Fresher's Hiring
Hexaview QA Fresher's Hiring
Location: Noida
Batch: 2020, 2021 and 2022 grads (BTech, MCA)
2 year Bond.
Location: Noida
Batch: 2020, 2021 and 2022 grads (BTech, MCA)
2 year Bond.
Forwarded from OffCampus Jobs | OnCampus Jobs | Daily Jobs Updates | Lastest Jobs | All Jobs | CSE Jobs | Fresher Jobs โฅ (Dushyant)
Smart Interviews is hiring for SDE 1 role (2021 and 2022 grads can apply)
https://www.linkedin.com/jobs/view/3456628470
CTC : 6-8 LPA
https://www.linkedin.com/jobs/view/3456628470
CTC : 6-8 LPA
Linkedin
Smart Interviews hiring Software Development Engineer - 1 in Hyderabad, Telangana, India | LinkedIn
Posted 1:30:49 PM. Hi there, weโre Smart Interviews.
Weโre on a mission to bridge the gap between education andโฆSee this and similar jobs on LinkedIn.
Weโre on a mission to bridge the gap between education andโฆSee this and similar jobs on LinkedIn.
๐1