Online Assessment
Questions:
Question 1
A number of bids are received for a project. Determine the number of distinct pairs of project costs where their absolute difference is some target value. Two pairs are distinct if they differ in at least one value.
-
Eg n=3, projectCosts = [1,3,5], target = 2 Output = 2 There are 2 pairs [1,3][3,5] with target difference 2. Therefore 2 is returned.
-
Eg n = 5, projectCosts = [1,5, 3, 4, 2], target = 2 Output = 3
Question 2
You have n chocolates with weights given in an array weights[n], where weights[i] represents the weight of the ith chocolate. Each day, you can pick one chocolate, consume half of its weight (calculated as floor(weight[i]/2)), and keep the remaining portion. Calculate the minimum possible total weight of the chocolate after d days. Note that you can eat from the same chocolate multiple times.
- Eg. weights = [2,3], d = 1; Output = 4
Round 1
Questions:
Question 1
Maximum path sum in a tree.
Question 2
Print the path of the maximum path sum.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.