You are given the root of a binary tree with n nodes. Each node is assigned a unique value from 1 to n. You are also given an array queries of size m.
You have to perform m independent queries on the tree where in the ith query you do the following:
Remove the subtree rooted at the node with the value queries[i] from the tree. It is guaranteed that queries[i] will not be equal to the value of the root.
Return an array answer of size m where answer[i] is the height of the tree after performing the ith query.
You have to perform m independent queries on the tree where in the ith query you do the following:
Remove the subtree rooted at the node with the value queries[i] from the tree. It is guaranteed that queries[i] will not be equal to the value of the root.
Return an array answer of size m where answer[i] is the height of the tree after performing the ith query.
Input: root = [5,8,9,2,1,3,7,4,6], queries = [3,2,4,8]
Output: [3,2,3,2]
Explanation: We have the following queries:
- Removing the subtree rooted at node with value 3. The height of the tree becomes 3 (The path 5 -> 8 -> 2 -> 4).
- Removing the subtree rooted at node with value 2. The height of the tree becomes 2 (The path 5 -> 8 -> 1).
- Removing the subtree rooted at node with value 4. The height of the tree becomes 3 (The path 5 -> 8 -> 2 -> 6).
- Removing the subtree rooted at node with value 8. The height of the tree becomes 2 (The path 5 -> 9 -> 3).
Output: [3,2,3,2]
Explanation: We have the following queries:
- Removing the subtree rooted at node with value 3. The height of the tree becomes 3 (The path 5 -> 8 -> 2 -> 4).
- Removing the subtree rooted at node with value 2. The height of the tree becomes 2 (The path 5 -> 8 -> 1).
- Removing the subtree rooted at node with value 4. The height of the tree becomes 3 (The path 5 -> 8 -> 2 -> 6).
- Removing the subtree rooted at node with value 8. The height of the tree becomes 2 (The path 5 -> 9 -> 3).
You are given two string arrays creators and ids, and an integer array views, all of length n. The ith video on a platform was created by creator[i], has an id of ids[i], and has views[i] views.
The popularity of a creator is the sum of the number of views on all of the creator's videos. Find the creator with the highest popularity and the id of their most viewed video.
If multiple creators have the highest popularity, find all of them.
If multiple videos have the highest view count for a creator, find the lexicographically smallest id.
Return a 2D array of strings answer where answer[i] = [creatori, idi] means that creatori has the highest popularity and idi is the id of their most popular video. The answer can be returned in any order.
The popularity of a creator is the sum of the number of views on all of the creator's videos. Find the creator with the highest popularity and the id of their most viewed video.
If multiple creators have the highest popularity, find all of them.
If multiple videos have the highest view count for a creator, find the lexicographically smallest id.
Return a 2D array of strings answer where answer[i] = [creatori, idi] means that creatori has the highest popularity and idi is the id of their most popular video. The answer can be returned in any order.
Java Hyd Team
I will send today's code tomorrow 😊
public class Employeee1 {
int empNo;
int basicSal;
int totalSal;
public Employeee1(int empNo, int basicSal) {
super();
this.empNo = empNo;
this.basicSal = basicSal;
}
public int getEmpNo() {
return empNo;
}
public void setEmpNo(int empNo) {
this.empNo = empNo;
}
public int getBasicSal() {
return basicSal;
}
public void setBasicSal(int basicSal) {
this.basicSal = basicSal;
}
public int getTotalSal() {
return totalSal;
}
public void setTotalSal(int totalSal) {
this.totalSal = totalSal;
}
@Override
public String toString() {
return "Employeee1 [empNo=" + empNo + ", basicSal=" + basicSal + ", totalSal=" + totalSal + "]";
}
}
int empNo;
int basicSal;
int totalSal;
public Employeee1(int empNo, int basicSal) {
super();
this.empNo = empNo;
this.basicSal = basicSal;
}
public int getEmpNo() {
return empNo;
}
public void setEmpNo(int empNo) {
this.empNo = empNo;
}
public int getBasicSal() {
return basicSal;
}
public void setBasicSal(int basicSal) {
this.basicSal = basicSal;
}
public int getTotalSal() {
return totalSal;
}
public void setTotalSal(int totalSal) {
this.totalSal = totalSal;
}
@Override
public String toString() {
return "Employeee1 [empNo=" + empNo + ", basicSal=" + basicSal + ", totalSal=" + totalSal + "]";
}
}
just now i have created a section in my gsheet for competitive coding i will update questions and solutions there so don't miss to join
basics i will share here and on my git competitive codes with answers i will update in gsheet only
Adobe is hiring for Member of technical Staff
Role : MTS
Experience: Freshers
Passout year: 2022 and before
Location : Noida
Qualification: B.Tech/BE/M.tech
CTC : 25-27 lpa
Apply Now: https://careers.adobe.com/us/en/job/R131831/Member-of-Technical-Staff-1
Role : MTS
Experience: Freshers
Passout year: 2022 and before
Location : Noida
Qualification: B.Tech/BE/M.tech
CTC : 25-27 lpa
Apply Now: https://careers.adobe.com/us/en/job/R131831/Member-of-Technical-Staff-1
Titan is hiring for Software Developer Intern
Role : SDE intern
Experience: student
Passout year: 2023
Qualification: B.Tech/BE/M.tech/MCA
Salary: 30k to 35k per month
Apply Now: https://docs.google.com/forms/d/e/1FAIpQLSd_afpWbQRENbl2LpWeqm2DweRVkJYWyy9EH0XwJ1afCImBvg/viewform
Role : SDE intern
Experience: student
Passout year: 2023
Qualification: B.Tech/BE/M.tech/MCA
Salary: 30k to 35k per month
Apply Now: https://docs.google.com/forms/d/e/1FAIpQLSd_afpWbQRENbl2LpWeqm2DweRVkJYWyy9EH0XwJ1afCImBvg/viewform
Scaler is hiring for Data Scientist and SME Intern
Role : Data Scientist and SME intern
Experience: student( 3 to 5 month)
Passout year: 2022/2023
Qualification: B.Tech/BE/M.tech/MCA
Salary: 30k to 35k per month
Apply Now: https://docs.google.com/forms/d/e/1FAIpQLSfLHx2FTTB3bSiQIuKXf3rcV667pV3Cvik_5frP4yig2Pa9RA/viewform
Role : Data Scientist and SME intern
Experience: student( 3 to 5 month)
Passout year: 2022/2023
Qualification: B.Tech/BE/M.tech/MCA
Salary: 30k to 35k per month
Apply Now: https://docs.google.com/forms/d/e/1FAIpQLSfLHx2FTTB3bSiQIuKXf3rcV667pV3Cvik_5frP4yig2Pa9RA/viewform